Re: Optimizing chmod(1)

2016-03-13 Thread Philip Guenther
On Sun, Mar 13, 2016 at 9:11 PM, Michael McConville  wrote:
> It seems that chown(1) will write to a file even if it already has the
> desired ownership. The below patch causes it to skip the write when
> there would be no change. The best I could tell, the fts_read(3) and
> fchownat(3) logic agree on whether to follow symlinks in all cases, so
> there's no need to execute a useless write when certain options are
> specified.

Regretfully, I don't think this can be the default behavior.  There
are filesystems where you can't whether chown() would be a no-op from
just checking the uid/gid, as the syscall may affect permission bits
or ACLs.  For example, an apparent no-op chown() will clear the
setuid/setgid bits.  (While we don't have ACLs on any native
filesystems, they may be accessible via NFS or fuse.)

I think that sort of complexity is why POSIX specifies that chown(8)
has the effect of calling chown(2) on each target, without leaving
room for skipping what might appear to be no-ops.


The existing solution for the problem of saving time when you really
are sure there's no magic bits to be changed is to use find to hunt
out the files that need it, ala
  find . ! -group www -exec chgrp -h www {} +

or even script it...
   fast_chgrp() { local grp=$1; shift; find "$@" ! -group $grp -exec
chgrp -h $grp {} +; }


Philip Guenther



Optimizing chmod(1)

2016-03-13 Thread Michael McConville
It seems that chown(1) will write to a file even if it already has the
desired ownership. The below patch causes it to skip the write when
there would be no change. The best I could tell, the fts_read(3) and
fchownat(3) logic agree on whether to follow symlinks in all cases, so
there's no need to execute a useless write when certain options are
specified.

I get a speedup of 5-10% on SSDs, and probably more on a slow storage
HD. This is when all the files are already owned by the specified user.
I think this is a common case, as chown is often used to "comb out"
offending files, ensure that a server can access everything in /var/www,
etc.

The APIs involved are not simple and there's potential for subtle
breakage, so this only an initial patch. I'm interested to hear what
more experienced people think.

If it's worthwhile, a similar approach can probably be applied to
chmod(1) et al. as well.

Thanks for your time,
Michael


Index: chmod.c
===
RCS file: /cvs/src/bin/chmod/chmod.c,v
retrieving revision 1.39
diff -u -p -r1.39 chmod.c
--- chmod.c 31 Dec 2015 23:38:16 -  1.39
+++ chmod.c 14 Mar 2016 04:01:39 -
@@ -63,8 +63,8 @@ main(int argc, char *argv[])
int oct;
mode_t omode;
int Hflag, Lflag, Rflag, ch, fflag, fts_options, hflag, rval, atflags;
-   uid_t uid;
-   gid_t gid;
+   uid_t uid, orig_uid;
+   gid_t gid, orig_gid;
u_int32_t fclear, fset;
char *ep, *mode, *cp, *flags;
 
@@ -213,7 +213,12 @@ done:
 
if ((ftsp = fts_open(++argv, fts_options, 0)) == NULL)
err(1, NULL);
+
for (rval = 0; (p = fts_read(ftsp)) != NULL;) {
+
+   orig_uid = p->fts_statp->st_uid;
+   orig_gid = p->fts_statp->st_gid;
+
switch (p->fts_info) {
case FTS_D:
if (!Rflag)
@@ -265,6 +270,16 @@ done:
|| fflag)
continue;
} else if (!ischflags) {
+   /*
+* Don't modify the file if it already has the
+* specified ownership. fts_read(3) and
+* fchownat(3) both handle the symlink logic, so
+* we know we're deciding based on the right
+* file.
+*/
+   if ((gid == -1 || gid == orig_gid) &&
+   (uid == -1 || uid == orig_uid))
+   continue;
if (!fchownat(AT_FDCWD, p->fts_accpath, uid, gid,
atflags) || fflag)
continue;



rework vlan(4) multicast handling

2016-03-13 Thread David Gwynne
this refactors the multicast handling in vlan(4) a bit.

the previous code had vlan_ether_purgemulti and vlan_ether_resetmulti,
each of which does too many things. purgemulti would try and remove
the multicast entries from the parent, and then free the local
copies of the addresses. resetmulti would try to remove the address
from the parent, and then optionally try to add them to a new parent.

resetmulti in particular makes the overall vlan config steps fairly
twisty.

the refactor offers vlan_multi_apply, and vlan_multi_free. multi_apply
simply adds or removes the multicast addresses from a parent
interface. it is now up to the config steps to call them appropriately
when configuring a parent or a new parent. vlan_multi_free only
deletes the memory associated with the vlans multicast addresses.

vlan_multi_apply is called when a parent is configured (ie, ifconfig
vlan0 up), or unconfigured (ifconfig vlan0 down or a detach of the
parent). vlan_multi_free is called when a vlan interface is destroyed
(ifconfig vlan0 destroy).

ok?


Index: if_vlan.c
===
RCS file: /cvs/src/sys/net/if_vlan.c,v
retrieving revision 1.154
diff -u -p -r1.154 if_vlan.c
--- if_vlan.c   13 Mar 2016 11:44:22 -  1.154
+++ if_vlan.c   14 Mar 2016 03:27:11 -
@@ -88,14 +88,15 @@ int vlan_config(struct ifvlan *, struct 
 void   vlan_vlandev_state(void *);
 void   vlanattach(int count);
 intvlan_set_promisc(struct ifnet *ifp);
-intvlan_ether_addmulti(struct ifvlan *, struct ifreq *);
-intvlan_ether_delmulti(struct ifvlan *, struct ifreq *);
-void   vlan_ether_purgemulti(struct ifvlan *);
-void   vlan_ether_resetmulti(struct ifvlan *, struct ifnet *);
 intvlan_clone_create(struct if_clone *, int);
 intvlan_clone_destroy(struct ifnet *);
 void   vlan_ifdetach(void *);
 
+intvlan_multi_add(struct ifvlan *, struct ifreq *);
+intvlan_multi_del(struct ifvlan *, struct ifreq *);
+void   vlan_multi_apply(struct ifvlan *, struct ifnet *, u_long);
+void   vlan_multi_free(struct ifvlan *);
+
 struct if_clone vlan_cloner =
 IF_CLONE_INITIALIZER("vlan", vlan_clone_create, vlan_clone_destroy);
 struct if_clone svlan_cloner =
@@ -194,6 +195,7 @@ vlan_clone_destroy(struct ifnet *ifp)
ether_ifdetach(ifp);
if_detach(ifp);
refcnt_finalize(>ifv_refcnt, "vlanrefs");
+   vlan_multi_free(ifv);
free(ifv, M_DEVBUF, sizeof(*ifv));
 
return (0);
@@ -481,6 +483,8 @@ vlan_config(struct ifvlan *ifv, struct i
ifv->dh_cookie = hook_establish(ifp0->if_detachhooks, 0,
vlan_ifdetach, ifv);
 
+   vlan_multi_apply(ifv, ifp0, SIOCADDMULTI);
+
vlan_vlandev_state(ifv);
 
/* Change input handler of the physical interface. */
@@ -538,7 +542,7 @@ vlan_unconfig(struct ifnet *ifp, struct 
 * while we were alive and remove them from the parent's list
 * as well.
 */
-   vlan_ether_resetmulti(ifv, newifp0);
+   vlan_multi_apply(ifv, ifp0, SIOCDELMULTI);
 
/* Disconnect from parent. */
ifv->ifv_p = NULL;
@@ -677,13 +681,11 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd
break;
 
case SIOCADDMULTI:
-   error = (ifv->ifv_p != NULL) ?
-   vlan_ether_addmulti(ifv, ifr) : EINVAL;
+   error = vlan_multi_add(ifv, ifr);
break;
 
case SIOCDELMULTI:
-   error = (ifv->ifv_p != NULL) ?
-   vlan_ether_delmulti(ifv, ifr) : EINVAL;
+   error = vlan_multi_del(ifv, ifr);
break;
default:
error = ENOTTY;
@@ -693,14 +695,14 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd
 
 
 int
-vlan_ether_addmulti(struct ifvlan *ifv, struct ifreq *ifr)
+vlan_multi_add(struct ifvlan *ifv, struct ifreq *ifr)
 {
-   struct ifnet*ifp0 = ifv->ifv_p;
+   struct ifnet*ifp0;
struct vlan_mc_entry*mc;
u_int8_t addrlo[ETHER_ADDR_LEN], addrhi[ETHER_ADDR_LEN];
int  error;
 
-   error = ether_addmulti(ifr, (struct arpcom *)>ifv_ac);
+   error = ether_addmulti(ifr, >ifv_ac);
if (error != ENETRESET)
return (error);
 
@@ -723,24 +725,28 @@ vlan_ether_addmulti(struct ifvlan *ifv, 
memcpy(>mc_addr, >ifr_addr, ifr->ifr_addr.sa_len);
LIST_INSERT_HEAD(>vlan_mc_listhead, mc, mc_entries);
 
-   if ((error = (*ifp0->if_ioctl)(ifp0, SIOCADDMULTI, (caddr_t)ifr)) != 0)
+   ifp0 = ifv->ifv_p;
+   error = (ifp0 == NULL) ? 0 :
+   (*ifp0->if_ioctl)(ifp0, SIOCADDMULTI, (caddr_t)ifr);
+
+   if (error != 0) 
goto ioctl_failed;
 
return (error);
 
  ioctl_failed:
LIST_REMOVE(mc, mc_entries);
-   free(mc, M_DEVBUF, sizeof *mc);
+   free(mc, M_DEVBUF, sizeof(*mc));
  alloc_failed:
-   (void)ether_delmulti(ifr, (struct arpcom *)>ifv_ac);
+   

Re: spamd - blacklists

2016-03-13 Thread Michael McConville
hans wrote:
> The link to "the place to search for blacklists" is dead.

Might be better to replace it than to remove it.

> Index: spamd.conf
> ===
> RCS file: /cvs/src/etc/mail/spamd.conf,v
> retrieving revision 1.4
> diff -u -p -r1.4 spamd.conf
> --- spamd.conf14 May 2012 16:58:46 -  1.4
> +++ spamd.conf13 Mar 2016 14:15:54 -
> @@ -12,9 +12,6 @@
>  # "all" must be here, and defines the order in which lists are applied.
>  # Lists specified with the :white: capability apply to the previous
>  # list with a :black: capability.
> -#
> -# As of November 2004, a place to search for blacklists is
> -# http://spamlinks.net/filter-bl.htm
>  
>  all:\
>   :uatraps:nixspam:
> 



multitouch support in wsmouse 3/3

2016-03-13 Thread Ulf Brosziewski

This patch adapts the synaptics driver to the changes described in 1/3 and
2/3.

wsconsio.h defines alternative names for the ABSOLUTE_Z and ABSOLUTE_W
events, namely
WSCONS_EVENT_TOUCH_PRESSURE and
WSCONS_EVENT_TOUCH_CONTACTS,
and wsmouse uses the latter exclusively for the plain contact count.  For
contact width, wsconsio.h defines the new event type
WSCONS_EVENT_TOUCH_WIDTH.

The event type
WSCONS_EVENT_TOUCH_RESET
is introduced in order to make the synaptics driver work properly with
input that is derived from MT state (I'm not happy with the event name,
perhaps someone has a better idea). This event - which has no value -
is generated whenever the absolute coordinates are being updated, but
no pointer motion events must be generated. Usually touchpad drivers
suppress pointer motion when the contact count changes. But this is not
sufficient for the MT case, because wsmouse may change the "pointer-
controlling" input slot even even when the contact count is constant.


Index: src/wsconscomm.c
===
RCS file: /cvs/xenocara/driver/xf86-input-synaptics/src/wsconscomm.c,v
retrieving revision 1.13
diff -u -p -r1.13 wsconscomm.c
--- src/wsconscomm.c29 Aug 2015 08:48:28 -  1.13
+++ src/wsconscomm.c11 Mar 2016 20:46:30 -
@@ -215,45 +215,29 @@ WSConsReadHwState(InputInfoPtr pInfo,
 hw->y = priv->maxy - event->value + priv->miny;
 hw->cumulative_dy = hw->y;
 break;
-case WSCONS_EVENT_MOUSE_ABSOLUTE_Z:
+case WSCONS_EVENT_TOUCH_PRESSURE:
 hw->z = event->value;
 break;
-case WSCONS_EVENT_MOUSE_ABSOLUTE_W:
-if (priv->model == MODEL_ELANTECH) {
-/* Elantech touchpads report number of fingers directly. */
-hw->fingerWidth = 5;
-hw->numFingers = event->value;
-break;
-}
-/* XXX magic number mapping which is mirrored in pms driver */
-switch (event->value) {
-case 0:
-hw->fingerWidth = 5;
-hw->numFingers = 2;
-break;
-case 1:
+case WSCONS_EVENT_TOUCH_CONTACTS:
+hw->numFingers = event->value;
+if (hw->numFingers == 0)
+hw->fingerWidth = 0;
+else if (hw->fingerWidth == 0)
 hw->fingerWidth = 5;
-hw->numFingers = 3;
-break;
-case 4 ... 5:
-hw->fingerWidth = event->value;
-hw->numFingers = 1;
-break;
-}
+break;
+case WSCONS_EVENT_TOUCH_WIDTH:
+hw->fingerWidth = event->value;
+break;
+case WSCONS_EVENT_TOUCH_RESET:
+/*
+ * The contact count or the active MT-slot has changed.
+ * Suppress pointer motion and two-finger scrolling.
+ */
+priv->count_packet_finger = 0;
+priv->vert_scroll_twofinger_on = FALSE;
+priv->horiz_scroll_twofinger_on = FALSE;
 break;
 case WSCONS_EVENT_SYNC:
-if (hw->z == 0) {
-hw->fingerWidth = 0;
-hw->numFingers = 0;
-} else if (hw->numFingers == 0) {
-/*
- * Because W may be 0 already, a two-finger touch on a
- * Synaptics touchpad doesn't necessarily produce an update
- * event for W.
- */
-hw->fingerWidth = 5;
-hw->numFingers = 2;
-}
 hw->millis = 1000 * event->time.tv_sec +
 event->time.tv_nsec / 100;
 SynapticsCopyHwState(hwRet, hw);



Re: malloc: 1st small step in long way to multiple pools

2016-03-13 Thread Juan Francisco Cantero Hurtado
On Wed, Mar 09, 2016 at 10:06:15AM +0100, Otto Moerbeek wrote:
> Hi,
> 
> a future goal for malloc is to use multiple pools in threaded environments,
> to reduce lock contention. 
> 
> This is a small first step towards that goal: move two globals to the
> pool-specific struct dir_info. Currently there's only a single pool,
> but that will change one day.
> 
> Lightly tested by myself on amd64, you can help by reviewing and
> testing this.

I don't see regressions on amd64.

-- 
Juan Francisco Cantero Hurtado http://juanfra.info



Re: [PATCH] - '^\' misaligned in vi's 'viusage'

2016-03-13 Thread Martijn van Duren
Fixed, thanks.

On 03/13/16 10:59, Raf Czlonka wrote:
> Hi all,
> 
> A superfluous  character causes '^\' to be misaligned in vi's
> 'viusage' command.
> 
> Regards,
> 
> Raf
> 
> Index: usr.bin/vi/vi/v_cmd.c
> ===
> RCS file: /cvs/src/usr.bin/vi/vi/v_cmd.c,v
> retrieving revision 1.4
> diff -u -p -r1.4 v_cmd.c
> --- usr.bin/vi/vi/v_cmd.c 27 Oct 2009 23:59:47 -  1.4
> +++ usr.bin/vi/vi/v_cmd.c 13 Mar 2016 09:46:14 -
> @@ -128,7 +128,7 @@ VIKEYS const vikeys [MAXVIKEY + 1] = {
>  /* 034  ^\ */
>   {v_exmode,  0,
>   "^\\",
> - " ^\\ switch to ex mode"},
> + "^\\ switch to ex mode"},
>  /* 035  ^] */
>   {v_tagpush, V_ABS|V_KEYW|VM_RCM_SET,
>   "^]",
> 



multitouch support in wsmouse 2/3

2016-03-13 Thread Ulf Brosziewski

These diffs adapt the drivers that attach to wsmouse to its new interface.
Most changes are fairly trivial and replace wsmouse_input calls with the
WSMOUSE_INPUT/WSMOUSE_TOUCH macros. However, some cases may need a second
thought. hidms, for example, now permits, at least in principle, to mix
relative and absolute coordinates, which looks somewhat strange. Do
scenarios exist where this makes sense?

I believe it doesn't make sense to stick to the Synaptics "W mode"
encoding in the wsmouse infrastructure any longer. Among the devices that
provide touch data it is an exception and not the common case. Please
note that the last argument of WSMOUSE_TOUCH is always the plain contact
count, not the W value as produced by Synaptics touchpads.

Drivers can pass 0 as contact count if it is redundant (wsmouse_touch
adapts the value to the pressure state). Width values must be reported
via wsmouse_set.

I haven't tried to introduce MT functions into drivers that I couldn't test,
up to now the elantech-v4 handler in pms is the only one that uses them. As
pointed out in the previous message, a call to wsmouse_mt_init is necessary
when the device is enabled.  Moreover, the ioctl function passes the mode
setting back to wsmouse via wsmouse_set_mode; the packet handler has no
branches for native mode and compat mode, the modes are handled by
wsmouse_input_sync. For the same reason there is no need to track
coordinates and check for deltas here, wsmouse does this anyway (with more
hardware information it could do more, like controlling and switching the
modes without that callback, and handling the other ioctl calls; the code
that is repeated over and over again in the wsmouse-dependent drivers could
be removed).


Index: arch/i386/isa/lms.c
===
RCS file: /cvs/src/sys/arch/i386/isa/lms.c,v
retrieving revision 1.20
diff -u -p -r1.20 lms.c
--- arch/i386/isa/lms.c 10 Apr 2007 22:37:17 -  1.20
+++ arch/i386/isa/lms.c 12 Mar 2016 20:42:46 -
@@ -235,8 +235,7 @@ lmsintr(void *arg)
sc->oldbuttons = buttons;

if (dx || dy || changed)
-   wsmouse_input(sc->sc_wsmousedev,
- buttons, dx, dy, 0, 0, WSMOUSE_INPUT_DELTA);
+   WSMOUSE_INPUT(sc->sc_wsmousedev, buttons, dx, dy, 0, 0);

return -1;
 }
Index: arch/i386/isa/mms.c
===
RCS file: /cvs/src/sys/arch/i386/isa/mms.c,v
retrieving revision 1.19
diff -u -p -r1.19 mms.c
--- arch/i386/isa/mms.c 10 Apr 2007 22:37:17 -  1.19
+++ arch/i386/isa/mms.c 12 Mar 2016 20:42:46 -
@@ -229,8 +229,7 @@ mmsintr(void *arg)
changed = status & 0x38;

if (dx || dy || changed)
-   wsmouse_input(sc->sc_wsmousedev,
- buttons, dx, dy, 0, 0, WSMOUSE_INPUT_DELTA);
+   WSMOUSE_INPUT(sc->sc_wsmousedev, buttons, dx, dy, 0, 0);

return -1;
 }
Index: arch/luna88k/dev/lunaws.c
===
RCS file: /cvs/src/sys/arch/luna88k/dev/lunaws.c,v
retrieving revision 1.11
diff -u -p -r1.11 lunaws.c
--- arch/luna88k/dev/lunaws.c   7 Jun 2014 11:55:35 -   1.11
+++ arch/luna88k/dev/lunaws.c   12 Mar 2016 20:42:46 -
@@ -260,9 +260,8 @@ wsintr(int chan)
else if (sc->sc_msreport == 2) {
sc->dy = (signed char)code;
if (sc->sc_wsmousedev != NULL)
-   wsmouse_input(sc->sc_wsmousedev,
-   sc->buttons, sc->dx, sc->dy, 0, 0,
-   WSMOUSE_INPUT_DELTA);
+   WSMOUSE_INPUT(sc->sc_wsmousedev,
+   sc->buttons, sc->dx, sc->dy, 0, 0);
sc->sc_msreport = 0;
}
 #else
Index: arch/sgi/hpc/z8530ms.c
===
RCS file: /cvs/src/sys/arch/sgi/hpc/z8530ms.c,v
retrieving revision 1.1
diff -u -p -r1.1 z8530ms.c
--- arch/sgi/hpc/z8530ms.c  17 Apr 2012 22:06:33 -  1.1
+++ arch/sgi/hpc/z8530ms.c  12 Mar 2016 20:42:47 -
@@ -296,7 +296,7 @@ zsms_wsmouse_input(struct zsms_softc *sc
x = (int)sc->packet[ZSMS_PACKET_X1] + (int)sc->packet[ZSMS_PACKET_X2];
y = (int)sc->packet[ZSMS_PACKET_Y1] + (int)sc->packet[ZSMS_PACKET_Y2];

-   wsmouse_input(sc->wsmousedev, btns, x, y, 0, 0, WSMOUSE_INPUT_DELTA);
+   WSMOUSE_INPUT(sc->sc_wsmousedev, btns, x, y, 0, 0);
 }

 int
Index: arch/zaurus/dev/zts.c
===
RCS file: /cvs/src/sys/arch/zaurus/dev/zts.c,v
retrieving revision 1.16
diff -u -p -r1.16 zts.c
--- arch/zaurus/dev/zts.c   29 Mar 2014 18:09:30 -  1.16
+++ arch/zaurus/dev/zts.c   12 Mar 2016 20:42:47 

multitouch support in wsmouse 1/3

2016-03-13 Thread Ulf Brosziewski

The diffs below are a rewrite of the input-processing part of wsmouse. It
adds support for multitouch input.

I have split the set of diffs into three parts and I will post part 2 and 3
in separate messages. Part 1 below contains all patches for wscons, part 2
is for the hardware drivers, part 3 is a patch for the synaptics driver in
xenocara (compiling that driver will require the modified version of
wsconsio.h in /usr/include/dev/wscons).

For those who had a look at the test version from December: The code for
the internal touchpad driver ("wstpad") is not included here, I intend
to add and present it again later. Apart from that there are only minor
changes. I have moved the input-processing functions into wsmouse.c,
renamed various things, and improved the tracking functions and the
handling of overflows of the event queue.

The wsmouse_input function has been removed. Hardware drivers make one
or more calls to the new "state-reporting" functions of wsmouse (see
wsmousevar.h), and signal that a frame is complete by calling
wsmouse_input_sync, which generates the wscons events. Roughly, the set
of functions corresponds to the different types of state: button state,
relative motion, absolute positions, single-touch state, and (MT) slot
state. "Standard" combinations of calls are covered by the macros
WSMOUSE_INPUT and WSMOUSE_TOUCH. There is also a more generic function
which can be used for less common inputs or requirements (wsmouse_set).

I assume that support for multi-user touch devices is not required, the
maximal number of MT slots is defined in wsmousevar.h as 10. The technical
limit is sizeof(u_int) * 8.

The MT structures in wsmouse must be initialized with a call to
wsmouse_mt_init.  Drivers for MT devices that associate touches with
"tracking IDs" can use wsmouse_id_to_slot() to assign or to look up slot
numbers, and call wsmouse_mtstate subsequently. hidmt may be a driver that
needs it. Drivers for MT devices that don't provide "MT tracking" - ubcmtp,
for example - must collect the contact points in an array of mtpoint
structures and pass it to wsmouse_mtframe, which computes a matching with
the points of the last frame and calls wsmouse_mtstate internally.

Currently MT state is always converted into a single-touch representation,
and wscons events are generated accordingly. No MT events have been defined
yet. However, minor changes in the set of events are necessary to make the
new code work cleanly with the synaptics driver (see 3/3).

I will comment on some more details in the next messages.

And, yes, this is a request for OKs.


Index: dev/wscons/wsmousevar.h
===
RCS file: /cvs/src/sys/dev/wscons/wsmousevar.h,v
retrieving revision 1.8
diff -u -p -r1.8 wsmousevar.h
--- dev/wscons/wsmousevar.h 21 Dec 2014 18:16:07 -  1.8
+++ dev/wscons/wsmousevar.h 12 Mar 2016 20:42:48 -
@@ -32,6 +32,22 @@
  */

 /*
+ * Copyright (c) 2015, 2016 Ulf Brosziewski
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
  * WSMOUSE interfaces.
  */

@@ -64,14 +80,151 @@ struct wsmousedev_attach_args {
  */
 intwsmousedevprint(void *, const char *);

+
+/* Process standard mouse input. */
+#define WSMOUSE_INPUT(sc_wsmousedev, btns, dx, dy, dz, dw) \
+   do {\
+   wsmouse_buttons((sc_wsmousedev), (btns));   \
+   wsmouse_motion((sc_wsmousedev), (dx), (dy), (dz), (dw));\
+   wsmouse_input_sync(sc_wsmousedev);  \
+   } while (0)
+
+
+/* Process standard touchpad input. */
+#define WSMOUSE_TOUCH(sc_wsmousedev, btns, x, y, pressure, contacts)   \
+   do {\
+   wsmouse_buttons((sc_wsmousedev), (btns));   \
+   wsmouse_position((sc_wsmousedev), (x), (y));\
+   wsmouse_touch((sc_wsmousedev), (pressure), (contacts)); \
+   wsmouse_input_sync(sc_wsmousedev);  \
+   } while (0)
+
+
+/*
+ * Drivers for touchpads that don't report pressure values can pass
+ * WSMOUSE_DEFAULT_PRESSURE to wsmouse_touch or wsmouse_mtstate.
+ *
+ * A pressure value of 0 

Re: New scheduler for OpenBSD

2016-03-13 Thread Amit Kulkarni
On Sat, Mar 12, 2016 at 10:36 AM, Michal Mazurek 
wrote:

> Gregor Best attempted to improve the scheduler in 2011:
> http://comments.gmane.org/gmane.os.openbsd.tech/27059
> Here is another attempt, it takes up where the previous one left off.
>
> This is also mostly based on the main idea behind Linux CFS or
> BFS. I found BFS to be described more clearly:
> http://ck.kolivas.org/patches/bfs/4.0/4.3/4.3-sched-bfs-467.patch
>
>
> Some notes:
>
> Chrome is still not very usable.
>
> Much more work is needed, e.g. there is some MD code on sparc64 and
> alpha that depends on spc_schedticks that needs to be understood and
> rewritten.
>
> Maybe using RB trees to queue what is usually no more than 5 elements
> is overkill.
>
> p_usrpri and p_priority will go away, so userland utilities like 'ps'
> will need to be changed.
>
> I also want to try and see if implementing one shared queue, instead of
> keeping one queue per cpu will improve performance even further. Right
> now there are some heuristics to determine whether a process should
> switch cpus. This doesn't work very well yet, in my tests with the
> attached code sometimes one queue was a second behind another. From
> what I understand that's the idea behind BFS and the reason why it
> doesn't scale to 4096 CPUs. I see that OpenBSD supports 256 CPUs on
> sparc64:
> ./arch/sparc64/include/cpu.h:#define MAXCPUS256
>
>
Hi Michal,
One shared queue is bad when # of CPU goes on increasing as it effectively
trends towards a global lock.
Thanks


battlestar include patch

2016-03-13 Thread Edgar Pettijohn

Index: dayfile.c
===
RCS file: /cvs/src/games/battlestar/dayfile.c,v
retrieving revision 1.12
diff -u -p -u -r1.12 dayfile.c
--- dayfile.c22 Nov 2009 09:16:02 -1.12
+++ dayfile.c13 Mar 2016 16:13:48 -
@@ -30,6 +30,8 @@
  * SUCH DAMAGE.
  */

+#include 
+
 #include "extern.h"

 struct room dayfile[] = {
Index: dayobjs.c
===
RCS file: /cvs/src/games/battlestar/dayobjs.c,v
retrieving revision 1.7
diff -u -p -u -r1.7 dayobjs.c
--- dayobjs.c27 Oct 2009 23:59:24 -1.7
+++ dayobjs.c13 Mar 2016 16:14:23 -
@@ -30,6 +30,8 @@
  * SUCH DAMAGE.
  */

+#include 
+
 #include "extern.h"

 const struct objs dayobjs[] = {
Index: extern.h
===
RCS file: /cvs/src/games/battlestar/extern.h,v
retrieving revision 1.20
diff -u -p -u -r1.20 extern.h
--- extern.h31 Dec 2015 17:51:19 -1.20
+++ extern.h13 Mar 2016 16:10:52 -
@@ -32,8 +32,6 @@
  *@(#)extern.h8.1 (Berkeley) 5/31/93
  */

-#include 
-
 #define BITS (8 * sizeof (int))

 #define OUTSIDE(position > 68 && position < 246 && position != 
218)

Index: globals.c
===
RCS file: /cvs/src/games/battlestar/globals.c,v
retrieving revision 1.14
diff -u -p -u -r1.14 globals.c
--- globals.c5 Apr 2013 01:28:27 -1.14
+++ globals.c13 Mar 2016 16:13:35 -
@@ -30,6 +30,8 @@
  * SUCH DAMAGE.
  */

+#include 
+
 #include "extern.h"

 int WEIGHT = MAXWEIGHT;
Index: misc.c
===
RCS file: /cvs/src/games/battlestar/misc.c,v
retrieving revision 1.8
diff -u -p -u -r1.8 misc.c
--- misc.c27 Oct 2009 23:59:24 -1.8
+++ misc.c13 Mar 2016 16:12:58 -
@@ -30,6 +30,8 @@
  * SUCH DAMAGE.
  */

+#include 
+
 #include "extern.h"

 /* for beenthere, injuries */
Index: nightfile.c
===
RCS file: /cvs/src/games/battlestar/nightfile.c,v
retrieving revision 1.11
diff -u -p -u -r1.11 nightfile.c
--- nightfile.c27 Oct 2009 23:59:24 -1.11
+++ nightfile.c13 Mar 2016 16:14:07 -
@@ -30,6 +30,8 @@
  * SUCH DAMAGE.
  */

+#include 
+
 #include "extern.h"

 struct room nightfile[] = {
Index: nightobjs.c
===
RCS file: /cvs/src/games/battlestar/nightobjs.c,v
retrieving revision 1.7
diff -u -p -u -r1.7 nightobjs.c
--- nightobjs.c27 Oct 2009 23:59:24 -1.7
+++ nightobjs.c13 Mar 2016 16:14:40 -
@@ -30,6 +30,8 @@
  * SUCH DAMAGE.
  */

+#include 
+
 #include "extern.h"

 const struct objs nightobjs[] = {
Index: words.c
===
RCS file: /cvs/src/games/battlestar/words.c,v
retrieving revision 1.10
diff -u -p -u -r1.10 words.c
--- words.c27 Oct 2009 23:59:24 -1.10
+++ words.c13 Mar 2016 16:14:56 -
@@ -30,6 +30,8 @@
  * SUCH DAMAGE.
  */

+#include 
+
 #include "extern.h"

 struct wlist wlist[] = {



backgammon include patch

2016-03-13 Thread Edgar Pettijohn
i'm really surprised that this saved 20s in build time.  i guess its 
worthwhile.


Index: backgammon/extra.c
===
RCS file: /cvs/src/games/backgammon/backgammon/extra.c,v
retrieving revision 1.8
diff -u -p -u -r1.8 extra.c
--- backgammon/extra.c30 Nov 2015 08:19:25 -1.8
+++ backgammon/extra.c13 Mar 2016 03:31:03 -
@@ -29,6 +29,9 @@
  * SUCH DAMAGE.
  */

+#include 
+#include 
+
 #include "back.h"
 #include "backlocal.h"

Index: backgammon/main.c
===
RCS file: /cvs/src/games/backgammon/backgammon/main.c,v
retrieving revision 1.23
diff -u -p -u -r1.23 main.c
--- backgammon/main.c3 Jan 2016 14:38:16 -1.23
+++ backgammon/main.c13 Mar 2016 03:37:21 -
@@ -29,7 +29,10 @@
  * SUCH DAMAGE.
  */

+#include 
 #include 
+#include 
+#include 

 #include "back.h"
 #include "backlocal.h"
Index: backgammon/move.c
===
RCS file: /cvs/src/games/backgammon/backgammon/move.c,v
retrieving revision 1.13
diff -u -p -u -r1.13 move.c
--- backgammon/move.c30 Nov 2015 08:19:25 -1.13
+++ backgammon/move.c13 Mar 2016 03:40:02 -
@@ -29,6 +29,10 @@
  * SUCH DAMAGE.
  */

+#include 
+#include 
+#include 
+
 #include "back.h"
 #include "backlocal.h"

Index: backgammon/pubeval.c
===
RCS file: /cvs/src/games/backgammon/backgammon/pubeval.c,v
retrieving revision 1.3
diff -u -p -u -r1.3 pubeval.c
--- backgammon/pubeval.c30 Nov 2015 08:19:25 -1.3
+++ backgammon/pubeval.c13 Mar 2016 03:41:28 -
@@ -33,6 +33,8 @@
  * (negative integer).
  */

+#include 
+
 #include "back.h"
 #include "backlocal.h"

Index: backgammon/text.c
===
RCS file: /cvs/src/games/backgammon/backgammon/text.c,v
retrieving revision 1.9
diff -u -p -u -r1.9 text.c
--- backgammon/text.c30 Nov 2015 08:19:25 -1.9
+++ backgammon/text.c13 Mar 2016 15:25:14 -
@@ -29,6 +29,8 @@
  * SUCH DAMAGE.
  */

+#include 
+
 #include "back.h"

 const char *const instruct[] = {
Index: common_source/allow.c
===
RCS file: /cvs/src/games/backgammon/common_source/allow.c,v
retrieving revision 1.6
diff -u -p -u -r1.6 allow.c
--- common_source/allow.c30 Nov 2015 08:19:25 -1.6
+++ common_source/allow.c13 Mar 2016 15:47:47 -
@@ -29,6 +29,8 @@
  * SUCH DAMAGE.
  */

+#include 
+
 #include "back.h"

 int
Index: common_source/back.h
===
RCS file: /cvs/src/games/backgammon/common_source/back.h,v
retrieving revision 1.15
diff -u -p -u -r1.15 back.h
--- common_source/back.h26 Dec 2015 00:26:39 -1.15
+++ common_source/back.h13 Mar 2016 03:18:33 -
@@ -31,18 +31,6 @@
  *@(#)back.h8.1 (Berkeley) 5/31/93
  */

-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
 #define rnum(r)arc4random_uniform(r)
 #define D0dice[0]
 #define D1dice[1]
Index: common_source/board.c
===
RCS file: /cvs/src/games/backgammon/common_source/board.c,v
retrieving revision 1.10
diff -u -p -u -r1.10 board.c
--- common_source/board.c30 Nov 2015 08:19:25 -1.10
+++ common_source/board.c13 Mar 2016 15:48:23 -
@@ -29,6 +29,10 @@
  * SUCH DAMAGE.
  */

+#include 
+
+#include 
+
 #include "back.h"

 void
Index: common_source/check.c
===
RCS file: /cvs/src/games/backgammon/common_source/check.c,v
retrieving revision 1.7
diff -u -p -u -r1.7 check.c
--- common_source/check.c30 Nov 2015 08:19:25 -1.7
+++ common_source/check.c13 Mar 2016 15:46:27 -
@@ -29,6 +29,11 @@
  * SUCH DAMAGE.
  */

+#include 
+
+#include 
+#include 
+
 #include "back.h"

 void
Index: common_source/fancy.c
===
RCS file: /cvs/src/games/backgammon/common_source/fancy.c,v
retrieving revision 1.13
diff -u -p -u -r1.13 fancy.c
--- common_source/fancy.c30 Nov 2015 08:19:25 -1.13
+++ common_source/fancy.c13 Mar 2016 03:32:43 -
@@ -29,7 +29,10 @@
  * SUCH DAMAGE.
  */

+#include 
 #include 
+#include 
+
 #include "back.h"

 int oldb[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
Index: common_source/init.c
===
RCS file: /cvs/src/games/backgammon/common_source/init.c,v
retrieving revision 1.11
diff -u -p -u -r1.11 init.c
--- common_source/init.c2 Dec 2015 20:05:01 -1.11
+++ common_source/init.c13 Mar 2016 15:43:48 -
@@ -33,11 +33,13 @@
  * variable initialization.
  */

+#include 
+
 

Re: New scheduler for OpenBSD

2016-03-13 Thread Martin Pieuchot
On 12/03/16(Sat) 17:36, Michal Mazurek wrote:
> [...] 
> Some notes:
> 
> Chrome is still not very usable.

Are you wanting to improve the browser experience on OpenBSD?  If that's
your goal then I'd suggest you to start by analysing how the browsers
behave.  My personal analysis makes me believe that librthread is what
needs some love.

> Much more work is needed, e.g. there is some MD code on sparc64 and
> alpha that depends on spc_schedticks that needs to be understood and
> rewritten.
>
> 
> Maybe using RB trees to queue what is usually no more than 5 elements
> is overkill.

I think it's overkill and makes your diff harder to read.

> p_usrpri and p_priority will go away, so userland utilities like 'ps'
> will need to be changed.

So what's your plan for process priorities?

> I also want to try and see if implementing one shared queue, instead of
> keeping one queue per cpu will improve performance even further. Right
> now there are some heuristics to determine whether a process should
> switch cpus. This doesn't work very well yet, in my tests with the
> attached code sometimes one queue was a second behind another. From
> what I understand that's the idea behind BFS and the reason why it
> doesn't scale to 4096 CPUs. I see that OpenBSD supports 256 CPUs on
> sparc64:
> ./arch/sparc64/include/cpu.h:#define MAXCPUS256

"improve performance" does not say much.  For which workload on which
machine?  There's maybe room for improvement in this area, but you
really need more than "building a kernel" as test bed.

> Is there a chance for a scheduler rewrite like this to be commited?

Maybe but not like this.  It would be nice if you could analyse various
workloads with the existing scheduler in order to argue that some of the
decisions made could be improved, then explain how the changes that
you're proposing in the existing scheduler improve things.

It's nice to see you experimenting with this and I think experimenting
is important but if your goal is to improve the existing software, you
also need to do measurements ;)

More comments on the diff below.

> Index: sys/kern/init_main.c
> ===
> RCS file: /cvs/src/sys/kern/init_main.c,v
> retrieving revision 1.248
> diff -u -p -r1.248 init_main.c
> --- sys/kern/init_main.c  3 Jan 2016 00:15:59 -   1.248
> +++ sys/kern/init_main.c  12 Mar 2016 15:48:36 -
> @@ -265,6 +265,8 @@ main(void *framep)
>*/
>   pr = 
>   process_initialize(pr, p);
> + p->p_deadline = 0;
> + p->p_rrticks = 10;

Here you could use rrticks_init ;)

>  
>   LIST_INSERT_HEAD(, pr, ps_list);
>   atomic_setbits_int(>ps_flags, PS_SYSTEM);
> @@ -554,6 +556,7 @@ main(void *framep)
>  /*
>   * proc0: nothing to do, back to sleep
>   */
> + printf("*** modified scheduler ***\n");
>  while (1)
>  tsleep(, PVM, "scheduler", 0);
>   /* NOTREACHED */
> Index: sys/kern/kern_clock.c
> ===
> RCS file: /cvs/src/sys/kern/kern_clock.c,v
> retrieving revision 1.88
> diff -u -p -r1.88 kern_clock.c
> --- sys/kern/kern_clock.c 11 Jun 2015 16:03:04 -  1.88
> +++ sys/kern/kern_clock.c 12 Mar 2016 15:48:36 -
> @@ -180,7 +180,7 @@ hardclock(struct clockframe *frame)
>   if (stathz == 0)
>   statclock(frame);
>  
> - if (--ci->ci_schedstate.spc_rrticks <= 0)
> + if (p && (--(p->p_rrticks) <= 0))
>   roundrobin(ci);

That's an interesting change.  Why did you decide to move a per-CPU
counter to a per-process one?  Can you explain the effect it will have?
Or even better can you measure its effect on different workloads?

>   /*
> @@ -398,15 +398,7 @@ statclock(struct clockframe *frame)
>  
>   if (p != NULL) {
>   p->p_cpticks++;
> - /*
> -  * If no schedclock is provided, call it here at ~~12-25 Hz;
> -  * ~~16 Hz is best
> -  */
> - if (schedhz == 0) {
> - if ((++curcpu()->ci_schedstate.spc_schedticks & 3) ==
> - 0)
> - schedclock(p);
> - }
> + ++curcpu()->ci_schedstate.spc_schedticks;
>   }
>  }
>  
> Index: sys/kern/kern_fork.c
> ===
> RCS file: /cvs/src/sys/kern/kern_fork.c,v
> retrieving revision 1.184
> diff -u -p -r1.184 kern_fork.c
> --- sys/kern/kern_fork.c  9 Oct 2015 01:10:27 -   1.184
> +++ sys/kern/kern_fork.c  12 Mar 2016 15:48:36 -
> @@ -498,6 +498,7 @@ fork1(struct proc *curp, int flags, void
>   /*
>* Make child runnable and add to run queue.
>*/
> + sched_deadline(p);
>   if ((flags & FORK_IDLE) == 0) {
>   SCHED_LOCK(s);
>   p->p_stat = SRUN;
> Index: sys/kern/kern_resource.c
> 

spamd - blacklists

2016-03-13 Thread hans
The link to "the place to search for blacklists" is dead.

Jan

Index: spamd.conf
===
RCS file: /cvs/src/etc/mail/spamd.conf,v
retrieving revision 1.4
diff -u -p -r1.4 spamd.conf
--- spamd.conf  14 May 2012 16:58:46 -  1.4
+++ spamd.conf  13 Mar 2016 14:15:54 -
@@ -12,9 +12,6 @@
 # "all" must be here, and defines the order in which lists are applied.
 # Lists specified with the :white: capability apply to the previous
 # list with a :black: capability.
-#
-# As of November 2004, a place to search for blacklists is
-# http://spamlinks.net/filter-bl.htm
 
 all:\
:uatraps:nixspam:



Re: nologin(8) overhaul

2016-03-13 Thread Benjamin Baier
Ping?
Also #include  could be omitted, because it gets pulled in
by unistd.h.

On Sun, 6 Mar 2016 16:14:14 +0100
Benjamin Baier  wrote:

> A /usr/bin/false vs. /sbin/nologin argument led me to nologin(8) so
> here are some suggestions.
> 
> - de-lint
> - return instead of exit()
> - no need to tell an *possible evil* ssh user that pledge(2) failed
> - some more churn/clean up
> 
> Greetings Ben
> 
> Index: nologin.c
> ===
> RCS file: /cvs/src/sbin/nologin/nologin.c,v
> retrieving revision 1.6
> diff -u -p -r1.6 nologin.c
> --- nologin.c 13 Oct 2015 07:10:38 -  1.6
> +++ nologin.c 6 Mar 2016 08:46:24 -
> @@ -26,19 +26,14 @@
>   */
>  
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
>  #include 
>  #include 
>  
> -/* Distinctly different from _PATH_NOLOGIN. */
> -#define _PATH_NOLOGIN_TXT"/etc/nologin.txt"
> -
>  #define DEFAULT_MESG "This account is currently not available.\n"
>  
> -/*ARGSUSED*/
>  int
>  main(int argc, char *argv[])
>  {
> @@ -47,17 +42,16 @@ main(int argc, char *argv[])
>   char nbuf[BUFSIZ];
>  
>   if (pledge("stdio rpath", NULL) == -1)
> - err(1, "pledge");
> + return (1);
>  
> - nfd = open(_PATH_NOLOGIN_TXT, O_RDONLY);
> - if (nfd < 0) {
> + nfd = open("/etc/nologin.txt", O_RDONLY);
> + if (nfd < 0)
>   write(STDOUT_FILENO, DEFAULT_MESG, strlen(DEFAULT_MESG));
> - exit (1);
> + else {
> + while ((nrd = read(nfd, nbuf, sizeof(nbuf))) != -1 && nrd != 0)
> + write(STDOUT_FILENO, nbuf, nrd);
> + close (nfd);
>   }
>  
> - while ((nrd = read(nfd, nbuf, sizeof(nbuf))) != -1 && nrd != 0)
> - write(STDOUT_FILENO, nbuf, nrd);
> - close (nfd);
> -
> - exit (1);
> + return (1);
>  }
> 



Re: malloc: 1st small step in long way to multiple pools

2016-03-13 Thread Jonathan Armani
On Wed, Mar 09, 2016 at 10:06:15AM +0100, Otto Moerbeek wrote:
> Hi,
> 
> a future goal for malloc is to use multiple pools in threaded environments,
> to reduce lock contention. 
> 
> This is a small first step towards that goal: move two globals to the
> pool-specific struct dir_info. Currently there's only a single pool,
> but that will change one day.
> 
> Lightly tested by myself on amd64, you can help by reviewing and
> testing this.
> 

Hi otto,

Diff looks good and I have been running it for a few days without
problem.




Re: malloc: 1st small step in long way to multiple pools

2016-03-13 Thread Stuart Henderson
On 2016/03/09 10:06, Otto Moerbeek wrote:
> Hi,
> 
> a future goal for malloc is to use multiple pools in threaded environments,
> to reduce lock contention. 
> 
> This is a small first step towards that goal: move two globals to the
> pool-specific struct dir_info. Currently there's only a single pool,
> but that will change one day.
> 
> Lightly tested by myself on amd64, you can help by reviewing and
> testing this.

No problems seen in a full ports build on i386. I've also been running
with it on my amd64 workstation and that has been fine too.



move vlan protocol definitions to if_ether.h

2016-03-13 Thread David Gwynne
vlans are a standard part of ethernet now, it makes sense to me to
keep all the protocol level stuff in a single place.

ok?

Index: net/if_vlan_var.h
===
RCS file: /cvs/src/sys/net/if_vlan_var.h,v
retrieving revision 1.32
diff -u -p -r1.32 if_vlan_var.h
--- net/if_vlan_var.h   3 Mar 2016 09:27:51 -   1.32
+++ net/if_vlan_var.h   13 Mar 2016 07:18:16 -
@@ -34,21 +34,6 @@
 #ifndef _NET_IF_VLAN_VAR_H_
 #define _NET_IF_VLAN_VAR_H_
 
-struct ether_vlan_header {
-   u_char  evl_dhost[ETHER_ADDR_LEN];
-   u_char  evl_shost[ETHER_ADDR_LEN];
-   u_int16_t evl_encap_proto;
-   u_int16_t evl_tag;
-   u_int16_t evl_proto;
-};
-
-#defineEVL_VLID_MASK   0x0FFF
-#defineEVL_VLANOFTAG(tag) ((tag) & EVL_VLID_MASK)
-#defineEVL_PRIOFTAG(tag) (((tag) >> EVL_PRIO_BITS) & 7)
-#defineEVL_ENCAPLEN4   /* length in octets of encapsulation */
-#defineEVL_PRIO_MAX7
-#defineEVL_PRIO_BITS   13
-
 /* sysctl(3) tags, for compatibility purposes */
 #defineVLANCTL_PROTO   1
 #defineVLANCTL_MAX 2
Index: netinet/if_ether.h
===
RCS file: /cvs/src/sys/netinet/if_ether.h,v
retrieving revision 1.67
diff -u -p -r1.67 if_ether.h
--- netinet/if_ether.h  1 Mar 2016 01:48:14 -   1.67
+++ netinet/if_ether.h  13 Mar 2016 07:18:16 -
@@ -75,6 +75,27 @@ struct   ether_header {
u_int16_t ether_type;
 };
 
+/*
+ * VLAN headers.
+ */
+
+struct  ether_vlan_header {
+u_char  evl_dhost[ETHER_ADDR_LEN];
+u_char  evl_shost[ETHER_ADDR_LEN];
+u_int16_t evl_encap_proto;
+u_int16_t evl_tag;
+u_int16_t evl_proto;
+};
+
+#define EVL_VLID_MASK   0x0FFF
+#define EVL_VLANOFTAG(tag) ((tag) & EVL_VLID_MASK)
+
+#define EVL_PRIO_MAX7
+#define EVL_PRIO_BITS   13
+#define EVL_PRIOFTAG(tag) (((tag) >> EVL_PRIO_BITS) & 7)
+
+#define EVL_ENCAPLEN4   /* length in octets of encapsulation */
+
 #include 
 
 #defineETHER_IS_MULTICAST(addr) (*(addr) & 0x01) /* is address 
mcast/bcast? */



Re: remove 'returns no value' from man pages

2016-03-13 Thread Marc Espie
On Sat, Mar 12, 2016 at 01:18:18PM -0800, Michael McConville wrote:
> Marc Espie wrote:
> > On Fri, Mar 11, 2016 at 05:18:52PM -0800, Michael McConville wrote:
> > > This is specified only irregularly, and people who don't know what a
> > > void return type means are beyond help anyway.
> > > 
> > > This also adds a sentence specifying that X509_free(3) is NULL-safe, now
> > > that we've removed all NULL-checks for it. I should sweep through and
> > > add the sentence the rest of the NULL-safe LibreSSL *_free() functions
> > > soon.
> > > 
> > > ok?
> > 
> > I would keep the one about rewind, maybe make it even stronger.
> > 
> > Using rewind is icky.   It deliberately hides an error message.
> 
> Sounds good - I'll leave that one and remove the rest. Let me know if
> you have a proposed wording for the additional rewind(3) warning.

You will have to work with jmc, I guess.  
I would probably go

The
.Fn rewind
function returns no value.
Prefer
.Fn fseek ,
which is just as portable, and does not hide errors.
.Pp



queue.3, tree.3 - SEE ALSO

2016-03-13 Thread Michal Mazurek
Refer to tree.3 from queue.3, and the other way around.

Index: share/man/man3/queue.3
===
RCS file: /cvs/src/share/man/man3/queue.3,v
retrieving revision 1.63
diff -u -p -r1.63 queue.3
--- share/man/man3/queue.3  19 Nov 2015 13:38:07 -  1.63
+++ share/man/man3/queue.3  13 Mar 2016 09:57:24 -
@@ -918,6 +918,8 @@ while ((np = TAILQ_FIRST())) {
 }
 
 .Ed
+.Sh SEE ALSO
+.Xr tree 3
 .Sh NOTES
 It is an error to assume the next and previous fields are preserved
 after an element has been removed from a list or queue.
Index: share/man/man3/tree.3
===
RCS file: /cvs/src/share/man/man3/tree.3,v
retrieving revision 1.27
diff -u -p -r1.27 tree.3
--- share/man/man3/tree.3   10 Nov 2015 23:48:17 -  1.27
+++ share/man/man3/tree.3   13 Mar 2016 09:57:24 -
@@ -549,6 +549,8 @@ main()
return (0);
 }
 .Ed
+.Sh SEE ALSO
+.Xr queue 3
 .Sh NOTES
 Trying to free a tree in the following way is a common error:
 .Bd -literal -offset indent

-- 
Michal Mazurek



[PATCH] - '^\' misaligned in vi's 'viusage'

2016-03-13 Thread Raf Czlonka
Hi all,

A superfluous  character causes '^\' to be misaligned in vi's
'viusage' command.

Regards,

Raf

Index: usr.bin/vi/vi/v_cmd.c
===
RCS file: /cvs/src/usr.bin/vi/vi/v_cmd.c,v
retrieving revision 1.4
diff -u -p -r1.4 v_cmd.c
--- usr.bin/vi/vi/v_cmd.c   27 Oct 2009 23:59:47 -  1.4
+++ usr.bin/vi/vi/v_cmd.c   13 Mar 2016 09:46:14 -
@@ -128,7 +128,7 @@ VIKEYS const vikeys [MAXVIKEY + 1] = {
 /* 034  ^\ */
{v_exmode,  0,
"^\\",
-   " ^\\ switch to ex mode"},
+   "^\\ switch to ex mode"},
 /* 035  ^] */
{v_tagpush, V_ABS|V_KEYW|VM_RCM_SET,
"^]",