Re: ral(4) diff

2011-03-12 Thread Igor Zinovik
On Mar 10, Tim van der Molen wrote: 
 I have the following ral(4):
 
 ral0 at pci0 dev 13 function 0 Ralink RT2561S rev 0x00: irq 5, address 
 00:1d:7d:49:28:92
 ral0: MAC/BBP RT2561C, RF RT2527
 
 After a commit from August 2010 (see
 http://marc.info/?l=openbsd-cvsm=128095139804862) the ral stopped
 working: clients could not associate with it in hostap mode and it could
 not detect other APs with ifconfig scan.
 
 After a hint from damien@ I came up with the following diff which brings
 back some of the code that was removed by the commit mentioned above.
 
 damien@ suggested I post the diff here. If you have an RT2561 or RT2661,
 please test it.

My ral(4) was running fine without this diff.  After i applied it
nothing changed, it is working normally.  Clients still can connect to my AP.

ral0 at pci2 dev 10 function 0 Ralink RT2561S rev 0x00: irq 11, address 
00:11:6b:35:03:d5
ral0: MAC/BBP RT2661B, RF RT2527




Re: use bswapq for swap64 on amd64

2011-03-12 Thread Mike Belopuhov
On Fri, Mar 11, 2011 at 14:45 -0800, Philip Guenther wrote:
 On Fri, 11 Mar 2011, Mike Belopuhov wrote:
  recent commit to pirofti made me wonder why don't we take an advantage 
  of the 64 bit bswap instruction on amd64?
 
 Here's a revised diff with two changes from Mike's:
  1) use %0 instead of %1, as the %N operands are zero-based.  (I dare 
 anyone to find a clear specification for the behavior of gcc for %N
 when then 'N' is the exact number of operands provided, like %1 in
 the current asm)
  2) include __statement to suppress warnings when compiled with -pedantic
 
 oks?
 

OK

 Philip Guenther
 
 
 Index: endian.h
 ===
 RCS file: /cvs/src/sys/arch/amd64/include/endian.h,v
 retrieving revision 1.4
 diff -u -p -r1.4 endian.h
 --- endian.h  11 Mar 2011 15:17:08 -  1.4
 +++ endian.h  11 Mar 2011 22:12:14 -
 @@ -29,25 +29,24 @@
  
  #ifdef __GNUC__
  
 -#define  __swap32md(x) ({
 \
 +#define  __swap32md(x) __statement({ 
 \
   u_int32_t __swap32md_x = (x);   \
   \
 - __asm (bswap %1 : +r (__swap32md_x));   \
 + __asm (bswap %0 : +r (__swap32md_x));   \
   __swap32md_x;   \
  })
  
 -/* XXX - I'm sure there is a better way on this cpu. */
 -#define  __swap64md(x) ({
 \
 +#define  __swap64md(x) __statement({ 
 \
   u_int64_t __swap64md_x = (x);   \
   \
 - (u_int64_t)__swap32md(__swap64md_x  32) | \
 - (u_int64_t)__swap32md(__swap64md_x  0x)  32; \
 + __asm (bswapq %0 : +r (__swap64md_x));  \
 + __swap64md_x;   \
  })
  
 -#define  __swap16md(x) ({
 \
 +#define  __swap16md(x) __statement({ 
 \
   u_int16_t __swap16md_x = (x);   \
   \
 - __asm (rorw $8, %w1 : +r (__swap16md_x));   \
 + __asm (rorw $8, %w0 : +r (__swap16md_x));   \
   __swap16md_x;   \
  })



Re: use bswapq for swap64 on amd64

2011-03-12 Thread Paul Irofti
On Fri, Mar 11, 2011 at 02:45:06PM -0800, Philip Guenther wrote:
 On Fri, 11 Mar 2011, Mike Belopuhov wrote:
  recent commit to pirofti made me wonder why don't we take an advantage 
  of the 64 bit bswap instruction on amd64?
 
 Here's a revised diff with two changes from Mike's:
  1) use %0 instead of %1, as the %N operands are zero-based.  (I dare 
 anyone to find a clear specification for the behavior of gcc for %N
 when then 'N' is the exact number of operands provided, like %1 in
 the current asm)
  2) include __statement to suppress warnings when compiled with -pedantic
 
 oks?

If we modify it like this, might as well do the same for the others.

i386, m68k, sh and vax have asm garbage as well.

 
 Philip Guenther
 
 
 Index: endian.h
 ===
 RCS file: /cvs/src/sys/arch/amd64/include/endian.h,v
 retrieving revision 1.4
 diff -u -p -r1.4 endian.h
 --- endian.h  11 Mar 2011 15:17:08 -  1.4
 +++ endian.h  11 Mar 2011 22:12:14 -
 @@ -29,25 +29,24 @@
  
  #ifdef __GNUC__
  
 -#define  __swap32md(x) ({
 \
 +#define  __swap32md(x) __statement({ 
 \
   u_int32_t __swap32md_x = (x);   \
   \
 - __asm (bswap %1 : +r (__swap32md_x));   \
 + __asm (bswap %0 : +r (__swap32md_x));   \
   __swap32md_x;   \
  })
  
 -/* XXX - I'm sure there is a better way on this cpu. */
 -#define  __swap64md(x) ({
 \
 +#define  __swap64md(x) __statement({ 
 \
   u_int64_t __swap64md_x = (x);   \
   \
 - (u_int64_t)__swap32md(__swap64md_x  32) | \
 - (u_int64_t)__swap32md(__swap64md_x  0x)  32; \
 + __asm (bswapq %0 : +r (__swap64md_x));  \
 + __swap64md_x;   \
  })
  
 -#define  __swap16md(x) ({
 \
 +#define  __swap16md(x) __statement({ 
 \
   u_int16_t __swap16md_x = (x);   \
   \
 - __asm (rorw $8, %w1 : +r (__swap16md_x));   \
 + __asm (rorw $8, %w0 : +r (__swap16md_x));   \
   __swap16md_x;   \
  })



zaurus and sun L keys (xkeyboard-config)

2011-03-12 Thread Alexandr Shadchin
Hi!

Add zaurus and support for the L keys for pc keyboards.
Need test.

ps:
Do not forget to set XENOCARA_USE_XKEYBOARD_CONFIG = Yes
when build xenocara.

-- 
Alexandr Shadchin

Index: data/xkeyboard-config/symbols/Makefile
===
RCS file: /cvs/xenocara/data/xkeyboard-config/symbols/Makefile,v
retrieving revision 1.3
diff -u -p -r1.3 Makefile
--- data/xkeyboard-config/symbols/Makefile  12 Mar 2011 10:16:01 -  
1.3
+++ data/xkeyboard-config/symbols/Makefile  12 Mar 2011 11:04:40 -
@@ -13,5 +13,8 @@ DATA= ad af al am ara at az ba bd be bg 
tz ua us uz vn za altwin capslock compose ctrl empty eurosign rupeesign 
\
group inet keypad kpdl level3 level5 nbsp olpc shift srvr_ctrl typo
 
+# OpenBSD customization
+DATA+= zaurus
+
 .include bsd.xorg.mk
 .include bsd.subdir.mk
Index: dist/xkeyboard-config/rules/base.ml_s.part
===
RCS file: /cvs/xenocara/dist/xkeyboard-config/rules/base.ml_s.part,v
retrieving revision 1.3
diff -u -p -r1.3 base.ml_s.part
--- dist/xkeyboard-config/rules/base.ml_s.part  12 Mar 2011 10:16:01 -  
1.3
+++ dist/xkeyboard-config/rules/base.ml_s.part  12 Mar 2011 11:04:41 -
@@ -40,3 +40,4 @@
   *$nonlatin   =   pc+us+%l%(v):2
   **   =   pc+%l%(v)
   htcdream us de it=   %l(htcdream)
+  zaurus   *   =   pc+zaurus
Index: dist/xkeyboard-config/symbols/pc
===
RCS file: /cvs/xenocara/dist/xkeyboard-config/symbols/pc,v
retrieving revision 1.3
diff -u -p -r1.3 pc
--- dist/xkeyboard-config/symbols/pc12 Mar 2011 10:16:01 -  1.3
+++ dist/xkeyboard-config/symbols/pc12 Mar 2011 11:04:41 -
@@ -40,6 +40,9 @@ xkb_symbols pc105 {
 
 key MENU {   [ Menu  ]   };
 
+// Sun LKeys section
+include sun_vndr/us(left_funkeys)
+
 // begin modifier mappings
 modifier_map Shift  { Shift_L, Shift_R };
 modifier_map Lock   { Caps_Lock, ISO_Lock };
Index: dist/xkeyboard-config/symbols/zaurus
===
RCS file: dist/xkeyboard-config/symbols/zaurus
diff -N dist/xkeyboard-config/symbols/zaurus
--- /dev/null   1 Jan 1970 00:00:00 -
+++ dist/xkeyboard-config/symbols/zaurus12 Mar 2011 11:04:41 -
@@ -0,0 +1,71 @@
+partial default alphanumeric_keys
+xkb_symbols basic {
+   name[Group1]= US/ASCII;
+
+   // Upper row
+   key AE01 { [ 1, exclam ] };
+   key AE02 { [ 2, quotedbl ] };
+   key AE03 { [ 3, numbersign ] };
+   key AE04 { [ 4, dollar ] };
+   key AE05 { [ 5, percent ] };
+   key AE06 { [ 6, ampersand ] };
+   key AE07 { [ 7, quoteright ] };
+   key AE08 { [ 8, parenleft ] };
+   key AE09 { [ 9, parenright ] };
+   key AE10 { [ 0, asciitilde ] };
+
+   key AD01 { [ q, Q ] };
+   key AD02 { [ w, W, asciicircum ] };
+   key AD03 { [ e, E, equal ] };
+   key AD04 { [ r, R, plus ] };
+   key AD05 { [ t, T, bracketleft ] };
+   key AD06 { [ y, Y, bracketright ] };
+   key AD07 { [ u, U, braceleft ] };
+   key AD08 { [ i, I, braceright ] };
+   key AD09 { [ o, O ] };
+   key AD10 { [ p, P ] };
+   
+   key TAB { [ Tab, ISO_Left_Tab, Caps_Lock ] };
+
+   key AC01 { [ a, A ] };
+   key AC02 { [ s, S ] };
+   key AC03 { [ d, D, quoteleft ] };
+   key AC04 { [ f, F, backslash ] };
+   key AC05 { [ g, G, semicolon ] };
+   key AC06 { [ h, H, colon ] };
+   key AC07 { [ j, J, asterisk ] };
+   key AC08 { [ k, K, yen ] };
+   key AC09 { [ l, L, bar ] };
+
+   key LFSH { [ Shift_L ] };
+   key AB01 { [ z, Z ] };
+   key AB02 { [ x, X, SunCut ] };
+   key AB03 { [ c, C, SunCopy ] };
+   // XXX Removed SunPaste from line below 
+   // because it triggers a bug in xterm translations.
+   key AB04 { [ v, V ] };
+   key AB05 { [ b, B, underscore ] };
+   key AB06 { [ n, N ] };
+   key AB07 { [ m, M ] };
+   key RTSH { [ Shift_R ] };
+   key RTRN { [ Return ] };
+   
+   key RALT { [ ISO_Level3_Shift ] };
+
+   key LCTL { [ Control_L ] };
+   key AE11 { [ minus, minus, at ] };
+   key SPCE { [ space ] };
+   key AB08 { [ comma, slash, less ] };
+   key AB09 { [ period, question, greater ] };
+   // End alphanumeric section
+   
+   // keypad
+   key UP { [ Up, Up, Prior ] };
+   key LEFT { [ Left, Left, Home ] };
+   key DOWN { [ Down, Down, Next ] };
+   key RGHT { [ Right, Right, End ] };
+
+   key ESC { [ Escape ] };
+
+   // include level3(ralt_switch)
+};
Index: dist/xkeyboard-config/symbols/sun_vndr/us
===
RCS file: 

Re: ral(4) diff

2011-03-12 Thread Sviatoslav Chagaev
On Thu, 10 Mar 2011 22:07:09 +0100
Tim van der Molen tb...@xs4all.nl wrote:

 I have the following ral(4):
 
 ral0 at pci0 dev 13 function 0 Ralink RT2561S rev 0x00: irq 5, address 
 00:1d:7d:49:28:92
 ral0: MAC/BBP RT2561C, RF RT2527
 
 After a commit from August 2010 (see
 http://marc.info/?l=openbsd-cvsm=128095139804862) the ral stopped
 working: clients could not associate with it in hostap mode and it could
 not detect other APs with ifconfig scan.
 
 After a hint from damien@ I came up with the following diff which brings
 back some of the code that was removed by the commit mentioned above.
 
 damien@ suggested I post the diff here. If you have an RT2561 or RT2661,
 please test it.
 
 Regards,
 Tim
 

Without the patch: after boot I type `ifconfig ral0 scan`, it outputs
the list of detected APs. All subsequent `ifconfig` commands have no
effect, including turning on 'monitor' and 'hostap'. Also, during or
shortly after the second `ifconfig ral0 scan`, a kernel message appears
saying ral0: device timeout.

With the patch: everything works as expected, including hostap mode.

OpenBSD 4.9-current (GENERIC) #1: Sun Mar 13 01:07:58 EET 2011
r...@scenic.my.domain:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: Intel Pentium III (GenuineIntel 686-class) 862 MHz
cpu0: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PSE36,MMX,FXSR,SSE
real mem  = 266891264 (254MB)
avail mem = 252387328 (240MB)
mainbus0 at root
bios0 at mainbus0: AT/286+ BIOS, date 03/11/02, BIOS32 rev. 0 @ 0xfd880, SMBIOS 
rev. 2.31 @ 0xefda0 (77 entries)
bios0: vendor FUJITSU SIEMENS // Phoenix Technologies Ltd. version 4.06  Rev. 
1.10.1215 date 03/11/2002
bios0: FUJITSU SIEMENS SCENIC xS/SCOVERY xS
apm0 at bios0: Power Management spec V1.2
apm0: AC on, battery charge unknown
acpi at bios0 function 0x0 not configured
pcibios0 at bios0: rev 2.1 @ 0xfd880/0x780
pcibios0: PCI IRQ Routing Table rev 1.0 @ 0xfdf20/192 (10 entries)
pcibios0: PCI Interrupt Router at 000:31:0 (Intel 82371FB ISA rev 0x00)
pcibios0: PCI bus #1 is the last bus
bios0: ROM list: 0xc/0xc000! 0xcc000/0x1000! 0xcd000/0x4000!
cpu0 at mainbus0: (uniprocessor)
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 0 function 0 Intel 82815 Host rev 0x04
vga1 at pci0 dev 2 function 0 Intel 82815 Video rev 0x04
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
intagp0 at vga1
agp0 at intagp0: aperture at 0xf800, size 0x400
ppb0 at pci0 dev 30 function 0 Intel 82801BA Hub-to-PCI rev 0x05
pci1 at ppb0 bus 1
fxp0 at pci1 dev 8 function 0 Intel 82562 rev 0x03, i82562: irq 15, address 
00:30:05:17:e5:c6
inphy0 at fxp0 phy 1: i82562EM 10/100 PHY, rev. 0
sis0 at pci1 dev 9 function 0 SiS 900 10/100BaseTX rev 0x02: irq 11, address 
00:06:4f:0e:94:ed
ukphy0 at sis0 phy 0: Generic IEEE 802.3u media interface, rev. 0: OUI 
0x000760, model 0x
ral0 at pci1 dev 11 function 0 Ralink RT2561S rev 0x00: irq 9, address 
00:0e:2e:4e:77:f1
ral0: MAC/BBP RT2561C, RF RT2527
ichpcib0 at pci0 dev 31 function 0 Intel 82801BA LPC rev 0x05: 24-bit timer 
at 3579545Hz
pciide0 at pci0 dev 31 function 1 Intel 82801BA IDE rev 0x05: DMA, channel 0 
wired to compatibility, channel 1 wired to compatibility
wd0 at pciide0 channel 0 drive 0: SAMSUNG SP0802N
wd0: 16-sector PIO, LBA48, 76351MB, 156368016 sectors
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 5
pciide0: channel 1 ignored (disabled)
uhci0 at pci0 dev 31 function 2 Intel 82801BA USB rev 0x05: irq 9
ichiic0 at pci0 dev 31 function 3 Intel 82801BA SMBus rev 0x05: irq 5
iic0 at ichiic0
spdmem0 at iic0 addr 0x55: 128MB SDRAM non-parity PC133CL2
spdmem1 at iic0 addr 0x56: 128MB SDRAM non-parity PC133CL3
uhci1 at pci0 dev 31 function 4 Intel 82801BA USB rev 0x05: irq 11
auich0 at pci0 dev 31 function 5 Intel 82801BA AC97 rev 0x05: irq 5, ICH2 AC97
ac97: codec id 0x41445360 (Analog Devices AD1885)
ac97: codec features headphone, Analog Devices Phat Stereo
audio0 at auich0
isa0 at ichpcib0
isadma0 at isa0
pckbc0 at isa0 port 0x60/5
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard, using wsdisplay0
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16
usb0 at uhci0: USB revision 1.0
uhub0 at usb0 Intel UHCI root hub rev 1.00/1.00 addr 1
usb1 at uhci1: USB revision 1.0
uhub1 at usb1 Intel UHCI root hub rev 1.00/1.00 addr 1
biomask 7ffd netmask fffd ttymask 
mtrr: Pentium Pro MTRR support
vscsi0 at root
scsibus0 at vscsi0: 256 targets
softraid0 at root
root on wd0a swap on wd0b dump on wd0b



wake on lan

2011-03-12 Thread Stefan Sperling
Now that arp(8) can send Wake On Lan frames (a.k.a. magic packets),
it would be nice to have a way to configure WOL from the operating system.

Some network cards need help from the OS to do WOL.
Some already do WOL without help from the OS.
For the latter it's nice to have a way to disable it.

This diff adds code to enable/disable WOL.
It's based on earlier diffs I've written for WOL which never went in,
and some discussion with Theo and Claudio.

If you have an re(4) or vr(4), you are lucky because those are the only
drivers supported so far. More drivers will be added later.

More often than not, WOL depends on BIOS settings.
Sometimes BIOS settings override what the OS wants, and vice versa.

Please test if you're interested in WOL. I'm particularly interested in
test reports with vr(4). The on-board vr(4) I have doesn't listen to the OS.
It only listens to the BIOS. Could someone owning a vr(4) verify that this
diff can enable and disable WOL regardless of (or in some combination with)
BIOS settings?

After booting the patched kernel, don't forget to run 'make includes'
in /usr/src before trying to compile ifconfig. Else, the if.h changes
won't be seen by ifconfig and it will fail to build.

Because this changes struct ifnet, sbin/route and usr.bin/netstat
may need to be recompiled, too.

Index: sbin/ifconfig/brconfig.h
===
RCS file: /cvs/src/sbin/ifconfig/brconfig.h,v
retrieving revision 1.3
diff -u -p -r1.3 brconfig.h
--- sbin/ifconfig/brconfig.h7 Jun 2010 15:05:42 -   1.3
+++ sbin/ifconfig/brconfig.h12 Mar 2011 22:48:05 -
@@ -68,7 +68,7 @@ int bridge_rule(int, char **, int);
 
 #defineIFFBITS \
 
\024\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5POINTOPOINT\6NOTRAILERS\7RUNNING\10NOARP\
-\11PROMISC\12ALLMULTI\13OACTIVE\14SIMPLEX\15LINK0\16LINK1\17LINK2\20MULTICAST\21TXREADY\22NOINET6\23INET6_PRIVACY\24MPLS
+\11PROMISC\12ALLMULTI\13OACTIVE\14SIMPLEX\15LINK0\16LINK1\17LINK2\20MULTICAST\21TXREADY\22NOINET6\23INET6_PRIVACY\24MPLS\25WOL
 
 void printb(char *, unsigned int, char *);
 
Index: sbin/ifconfig/ifconfig.8
===
RCS file: /cvs/src/sbin/ifconfig/ifconfig.8,v
retrieving revision 1.213
diff -u -p -r1.213 ifconfig.8
--- sbin/ifconfig/ifconfig.817 Feb 2011 08:32:29 -  1.213
+++ sbin/ifconfig/ifconfig.812 Mar 2011 22:55:55 -
@@ -435,6 +435,27 @@ This may be used to enable an interface 
 It happens automatically when setting the first address on an interface.
 If the interface was reset when previously marked down,
 the hardware will be re-initialized.
+.Pp
+.It Cm wol
+Enable Wake On Lan.
+When enabled, reception of a Wake On Lan frame (a.k.a. Magic Packet)
+will cause the network card to power up the system from standby or
+suspend mode.
+Wake On Lan frames can be sent with
+.Xr arp 8 .
+Support for Wake On Lan depends on various factors,
+some of which may not be under control of the operating system.
+Configuration parameters in the system BIOS or firmware can affect Wake On Lan.
+.Pp
+Wake On Lan should not be enabled on interfaces that can receive traffic
+from the internet.
+It should only be enabled on dedicated management interfaces connected to
+networks where no packets can be injected by untrusted parties.
+Wake On Lan frames can be sent in routable IP packets and are not 
authenticated.
+.It Fl wol
+Disable Wake On Lan.
+Wake On Lan is disabled by default if possible.
+The operating system cannot disable Wake On Lan on some machines.
 .El
 .Pp
 .Nm
Index: share/man/man4/re.4
===
RCS file: /cvs/src/share/man/man4/re.4,v
retrieving revision 1.44
diff -u -p -r1.44 re.4
--- share/man/man4/re.4 8 Jul 2010 09:19:11 -   1.44
+++ share/man/man4/re.4 12 Mar 2011 23:35:47 -
@@ -168,6 +168,10 @@ Force full duplex operation.
 Force half duplex operation.
 .El
 .Pp
+The
+.Nm
+driver supports Wake On Lan.
+.Pp
 For more information on configuring this device, see
 .Xr ifconfig 8 .
 .Sh SEE ALSO
Index: share/man/man4/vr.4
===
RCS file: /cvs/src/share/man/man4/vr.4,v
retrieving revision 1.22
diff -u -p -r1.22 vr.4
--- share/man/man4/vr.4 16 Mar 2009 22:47:45 -  1.22
+++ share/man/man4/vr.4 12 Mar 2011 23:36:21 -
@@ -104,6 +104,11 @@ Force half duplex operation.
 .Pp
 Note that the 100baseTX media type is only available if supported
 by the adapter.
+.Pp
+The
+.Nm
+driver supports Wake On Lan.
+.Pp
 For more information on configuring this device, see
 .Xr ifconfig 8 .
 .Sh DIAGNOSTICS
Index: sbin/ifconfig/ifconfig.c
===
RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v
retrieving revision 1.244
diff -u -p -r1.244 ifconfig.c
--- sbin/ifconfig/ifconfig.c1 Mar 2011 09:37:31 -   1.244
+++ sbin/ifconfig/ifconfig.c12 Mar 2011 

socket splicing with kqueue

2011-03-12 Thread Alexander Bluhm
Hi,

I have two more socket splicing fixes.

When a process reads from a spliced socket that already got an
end-of-file but still has data in the receive buffer, soreceive()
should block until all data has been moved.  Note that (so-so_rcv.sb_cc
== 0) can only be false, if splicing is active.  Otherwise it would
panic a few lines above.

To make kqueue work with socket splicing, it has to report spliced
sockets as non-readable.

ok?

bluhm


Index: kern/uipc_socket.c
===
RCS file: /data/mirror/openbsd/cvs/src/sys/kern/uipc_socket.c,v
retrieving revision 1.87
diff -u -p -r1.87 uipc_socket.c
--- kern/uipc_socket.c  12 Mar 2011 18:31:41 -  1.87
+++ kern/uipc_socket.c  12 Mar 2011 22:41:27 -
@@ -650,7 +650,7 @@ restart:
if (so-so_state  SS_CANTRCVMORE) {
if (m)
goto dontblock;
-   else
+   else if (so-so_rcv.sb_cc == 0)
goto release;
}
for (; m; m = m-m_next)
@@ -1633,6 +1637,10 @@ filt_soread(struct knote *kn, long hint)
struct socket *so = (struct socket *)kn-kn_fp-f_data;
 
kn-kn_data = so-so_rcv.sb_cc;
+#ifdef SOCKET_SPLICE
+   if (so-so_splice)
+   return (0);
+#endif /* SOCKET_SPLICE */
if (so-so_state  SS_CANTRCVMORE) {
kn-kn_flags |= EV_EOF;
kn-kn_fflags = so-so_error;



Use appropriate timerclear macro on ifstated.

2011-03-12 Thread Christiano F. Haesbaert
Index: ifstated.c
===
RCS file: /cvs/src/usr.sbin/ifstated/ifstated.c,v
retrieving revision 1.38
diff -d -u -p -w -r1.38 ifstated.c
--- ifstated.c  7 Jul 2010 21:52:00 -   1.38
+++ ifstated.c  13 Mar 2011 00:47:21 -
@@ -144,8 +144,7 @@ main(int argc, char *argv[])
signal_add(sigchld_ev, NULL);
 
/* Loading the config needs to happen in the event loop */
-   tv.tv_usec = 0;
-   tv.tv_sec = 0;
+   timerclear(tv);
evtimer_set(startup_ev, startup_handler, NULL);
evtimer_add(startup_ev, tv);
 
@@ -252,7 +251,7 @@ external_handler(int fd, short event, vo
struct timeval tv;
 
/* re-schedule */
-   tv.tv_usec = 0;
+   timerclear(tv);
tv.tv_sec = external-frequency;
evtimer_set(external-ev, external_handler, external);
evtimer_add(external-ev, tv);
@@ -382,7 +381,7 @@ external_evtimer_setup(struct ifsd_state
external_exec(external, 0);
 
/* schedule it for later */
-   tv.tv_usec = 0;
+   timerclear(tv);
tv.tv_sec = external-frequency;
evtimer_set(external-ev, external_handler,
external);