Re: systat(1) sticky help

2021-02-28 Thread Martijn van Duren
On Sun, 2021-02-28 at 23:03 -0800, Anindya Mukherjee wrote:
> Hi,
> 
> Thanks for the feedback. I see your point. Perhaps it would be better to
> have a separate "stickiness" toggle and not tie it to the help or the
> view name display functions. For example, pressing 't' could toggle it
> on and then pressing 'h' or Ctrl-G would make the display stick.
> Pressing 't' again would toggle it off, and then the display would get
> cleared normally.

Something like that seems better, but keep in mind that the single key
bindings within systat is a mess: 't' might already be allocated by one
of the views. When submitting your followup, try to make sure that you
considered all possible issues, including the keybindings, and show
how you came to your conclusion.
> 
> Regards,
> Anindya
> 
> On Mon, Mar 01, 2021 at 07:49:49AM +0100, Martijn van Duren wrote:
> > Although the feature *might* be useful (just woken up, so haven't given
> > it too much thought), the bindings have some problems and need to be
> > reworked if we decide to get this in. Problems that I see from just a
> > few short tests (so there might be others):
> > - Entering sticky: H, which also enters help, which is annoying if I
> >   want sticky ^G.
> > - Clearing sticky: h, which also displays help, which if I come from
> >   ^G is not what I want and if I'm in help is confusing, because I want
> >   to get rid of it.
> > 
> > martijn@
> > 
> > On Sun, 2021-02-28 at 19:40 -0800, Anindya Mukherjee wrote:
> > > Hi,
> > > 
> > > I tend to keep systat(1) running in interactive mode, and find it very
> > > useful to have the help line displayed permanently, i.e., not disappear
> > > if a key is pressed or after a command is executed. The same goes for
> > > the Ctrl-G display. For example, it tells me what modes are adjacent to
> > > the currently active one when pressing left or right arrow keys.
> > > 
> > > The attached diff adds this feature. It is off by default. I noticed
> > > that the 'h' key was not documented in the man page, so I took the
> > > liberty of adding a line describing it.
> > > 
> > > Hope it is useful. Please have a look, thanks!
> > > 
> > > Regards,
> > > Anindya
> > > 
> > > Index: engine.c
> > > ===
> > > RCS file: /cvs/src/usr.bin/systat/engine.c,v
> > > retrieving revision 1.27
> > > diff -u -p -r1.27 engine.c
> > > --- engine.c6 Feb 2021 06:19:28 -   1.27
> > > +++ engine.c1 Mar 2021 03:20:41 -
> > > @@ -70,6 +70,8 @@ volatile sig_atomic_t gotsig_alarm = 0;
> > >  int need_update = 0;
> > >  int need_sort = 0;
> > >  int separate_thousands = 0;
> > > +int viewmode = 0;
> > > +int sticky = 0;
> > >  
> > >  SCREEN *screen;
> > >  
> > > @@ -1139,7 +1141,9 @@ command_set(struct command *cmd, const c
> > > cmdbuf[0] = 0;
> > > }
> > > }
> > > -   message_set(NULL);
> > > +
> > > +   if (!sticky)
> > > +   message_set(NULL);
> > > curr_cmd = cmd;
> > > need_update = 1;
> > > return prev;
> > > @@ -1234,7 +1238,7 @@ keyboard(void)
> > > return;
> > >  
> > > if (curr_message != NULL) {
> > > -   if (ch > 0) {
> > > +   if (ch > 0 && !sticky) {
> > > message_set(NULL);
> > > need_update = 1;
> > > }
> > > @@ -1359,8 +1363,15 @@ engine_loop(int countmax)
> > > if (need_update) {
> > > erase();
> > > if (!averageonly ||
> > > -   (averageonly && count == countmax - 1))
> > > +   (averageonly && count == countmax - 1)) {
> > > disp_update();
> > > +   if (interactive && sticky) {
> > > +   if (viewmode)
> > > +   show_view();
> > > +   else
> > > +   show_help();
> > > +   }
> > > +   }
> > > end_page();
> > > need_update = 0;
> > > if (countmax && ++count >= countmax)
> > > Index: engine.h
> > > ===
> > > RCS file: /cvs/src/usr.bin/systat/engine.h,v
> > > retrieving revision 1.12
> > > diff -u -p -r1.12 engine.h
> > > --- engine.h12 Jan 2020 20:51:08 -  1.12
> > > +++ engine.h1 Mar 2021 03:20:41 -
> > > @@ -144,6 +144,8 @@ struct command *command_set(struct comma
> > >  const char *message_set(const char *msg);
> > >  
> > >  void foreach_view(void (*callback)(field_view *));
> > > +void show_help(void);
> > > +void show_view(void);
> > >  
> > >  extern int sortdir;
> > >  extern useconds_t udelay;
> > > 

Re: systat(1) sticky help

2021-02-28 Thread Anindya Mukherjee
Hi,

Thanks for the feedback. I see your point. Perhaps it would be better to
have a separate "stickiness" toggle and not tie it to the help or the
view name display functions. For example, pressing 't' could toggle it
on and then pressing 'h' or Ctrl-G would make the display stick.
Pressing 't' again would toggle it off, and then the display would get
cleared normally.

Regards,
Anindya

On Mon, Mar 01, 2021 at 07:49:49AM +0100, Martijn van Duren wrote:
> Although the feature *might* be useful (just woken up, so haven't given
> it too much thought), the bindings have some problems and need to be
> reworked if we decide to get this in. Problems that I see from just a
> few short tests (so there might be others):
> - Entering sticky: H, which also enters help, which is annoying if I
>   want sticky ^G.
> - Clearing sticky: h, which also displays help, which if I come from
>   ^G is not what I want and if I'm in help is confusing, because I want
>   to get rid of it.
> 
> martijn@
> 
> On Sun, 2021-02-28 at 19:40 -0800, Anindya Mukherjee wrote:
> > Hi,
> > 
> > I tend to keep systat(1) running in interactive mode, and find it very
> > useful to have the help line displayed permanently, i.e., not disappear
> > if a key is pressed or after a command is executed. The same goes for
> > the Ctrl-G display. For example, it tells me what modes are adjacent to
> > the currently active one when pressing left or right arrow keys.
> > 
> > The attached diff adds this feature. It is off by default. I noticed
> > that the 'h' key was not documented in the man page, so I took the
> > liberty of adding a line describing it.
> > 
> > Hope it is useful. Please have a look, thanks!
> > 
> > Regards,
> > Anindya
> > 
> > Index: engine.c
> > ===
> > RCS file: /cvs/src/usr.bin/systat/engine.c,v
> > retrieving revision 1.27
> > diff -u -p -r1.27 engine.c
> > --- engine.c6 Feb 2021 06:19:28 -   1.27
> > +++ engine.c1 Mar 2021 03:20:41 -
> > @@ -70,6 +70,8 @@ volatile sig_atomic_t gotsig_alarm = 0;
> >  int need_update = 0;
> >  int need_sort = 0;
> >  int separate_thousands = 0;
> > +int viewmode = 0;
> > +int sticky = 0;
> >  
> >  SCREEN *screen;
> >  
> > @@ -1139,7 +1141,9 @@ command_set(struct command *cmd, const c
> > cmdbuf[0] = 0;
> > }
> > }
> > -   message_set(NULL);
> > +
> > +   if (!sticky)
> > +   message_set(NULL);
> > curr_cmd = cmd;
> > need_update = 1;
> > return prev;
> > @@ -1234,7 +1238,7 @@ keyboard(void)
> > return;
> >  
> > if (curr_message != NULL) {
> > -   if (ch > 0) {
> > +   if (ch > 0 && !sticky) {
> > message_set(NULL);
> > need_update = 1;
> > }
> > @@ -1359,8 +1363,15 @@ engine_loop(int countmax)
> > if (need_update) {
> > erase();
> > if (!averageonly ||
> > -   (averageonly && count == countmax - 1))
> > +   (averageonly && count == countmax - 1)) {
> > disp_update();
> > +   if (interactive && sticky) {
> > +   if (viewmode)
> > +   show_view();
> > +   else
> > +   show_help();
> > +   }
> > +   }
> > end_page();
> > need_update = 0;
> > if (countmax && ++count >= countmax)
> > Index: engine.h
> > ===
> > RCS file: /cvs/src/usr.bin/systat/engine.h,v
> > retrieving revision 1.12
> > diff -u -p -r1.12 engine.h
> > --- engine.h12 Jan 2020 20:51:08 -  1.12
> > +++ engine.h1 Mar 2021 03:20:41 -
> > @@ -144,6 +144,8 @@ struct command *command_set(struct comma
> >  const char *message_set(const char *msg);
> >  
> >  void foreach_view(void (*callback)(field_view *));
> > +void show_help(void);
> > +void show_view(void);
> >  
> >  extern int sortdir;
> >  extern useconds_t udelay;
> > @@ -160,6 +162,8 @@ extern int columns, lines;
> >  extern int need_update;
> >  extern int need_sort;
> >  extern int separate_thousands;
> > +extern int viewmode;
> > +extern int sticky;
> >  
> >  extern volatile sig_atomic_t gotsig_close;
> >  extern volatile sig_atomic_t gotsig_resize;
> > Index: main.c
> > ===
> > RCS file: /cvs/src/usr.bin/systat/main.c,v
> > retrieving revision 1.73
> > diff -u -p -r1.73 main.c
> > --- main.c  30 Jan 2021 08:44:42 -  1.73
> > +++ main.c  1 Mar 2021 03:20:41 -
> > @@ 

Re: systat(1) sticky help

2021-02-28 Thread Martijn van Duren
Although the feature *might* be useful (just woken up, so haven't given
it too much thought), the bindings have some problems and need to be
reworked if we decide to get this in. Problems that I see from just a
few short tests (so there might be others):
- Entering sticky: H, which also enters help, which is annoying if I
  want sticky ^G.
- Clearing sticky: h, which also displays help, which if I come from
  ^G is not what I want and if I'm in help is confusing, because I want
  to get rid of it.

martijn@

On Sun, 2021-02-28 at 19:40 -0800, Anindya Mukherjee wrote:
> Hi,
> 
> I tend to keep systat(1) running in interactive mode, and find it very
> useful to have the help line displayed permanently, i.e., not disappear
> if a key is pressed or after a command is executed. The same goes for
> the Ctrl-G display. For example, it tells me what modes are adjacent to
> the currently active one when pressing left or right arrow keys.
> 
> The attached diff adds this feature. It is off by default. I noticed
> that the 'h' key was not documented in the man page, so I took the
> liberty of adding a line describing it.
> 
> Hope it is useful. Please have a look, thanks!
> 
> Regards,
> Anindya
> 
> Index: engine.c
> ===
> RCS file: /cvs/src/usr.bin/systat/engine.c,v
> retrieving revision 1.27
> diff -u -p -r1.27 engine.c
> --- engine.c6 Feb 2021 06:19:28 -   1.27
> +++ engine.c1 Mar 2021 03:20:41 -
> @@ -70,6 +70,8 @@ volatile sig_atomic_t gotsig_alarm = 0;
>  int need_update = 0;
>  int need_sort = 0;
>  int separate_thousands = 0;
> +int viewmode = 0;
> +int sticky = 0;
>  
>  SCREEN *screen;
>  
> @@ -1139,7 +1141,9 @@ command_set(struct command *cmd, const c
> cmdbuf[0] = 0;
> }
> }
> -   message_set(NULL);
> +
> +   if (!sticky)
> +   message_set(NULL);
> curr_cmd = cmd;
> need_update = 1;
> return prev;
> @@ -1234,7 +1238,7 @@ keyboard(void)
> return;
>  
> if (curr_message != NULL) {
> -   if (ch > 0) {
> +   if (ch > 0 && !sticky) {
> message_set(NULL);
> need_update = 1;
> }
> @@ -1359,8 +1363,15 @@ engine_loop(int countmax)
> if (need_update) {
> erase();
> if (!averageonly ||
> -   (averageonly && count == countmax - 1))
> +   (averageonly && count == countmax - 1)) {
> disp_update();
> +   if (interactive && sticky) {
> +   if (viewmode)
> +   show_view();
> +   else
> +   show_help();
> +   }
> +   }
> end_page();
> need_update = 0;
> if (countmax && ++count >= countmax)
> Index: engine.h
> ===
> RCS file: /cvs/src/usr.bin/systat/engine.h,v
> retrieving revision 1.12
> diff -u -p -r1.12 engine.h
> --- engine.h12 Jan 2020 20:51:08 -  1.12
> +++ engine.h1 Mar 2021 03:20:41 -
> @@ -144,6 +144,8 @@ struct command *command_set(struct comma
>  const char *message_set(const char *msg);
>  
>  void foreach_view(void (*callback)(field_view *));
> +void show_help(void);
> +void show_view(void);
>  
>  extern int sortdir;
>  extern useconds_t udelay;
> @@ -160,6 +162,8 @@ extern int columns, lines;
>  extern int need_update;
>  extern int need_sort;
>  extern int separate_thousands;
> +extern int viewmode;
> +extern int sticky;
>  
>  extern volatile sig_atomic_t gotsig_close;
>  extern volatile sig_atomic_t gotsig_resize;
> Index: main.c
> ===
> RCS file: /cvs/src/usr.bin/systat/main.c,v
> retrieving revision 1.73
> diff -u -p -r1.73 main.c
> --- main.c  30 Jan 2021 08:44:42 -  1.73
> +++ main.c  1 Mar 2021 03:20:41 -
> @@ -285,6 +285,14 @@ cmd_compat(const char *buf)
>  
> if (strcasecmp(buf, "help") == 0) {
> show_help();
> +   sticky = 0;
> +   need_update = 1;
> +   return;
> +   }
> +   if (strcasecmp(buf, "stickyhelp") == 0) {
> +   show_help();
> +   sticky = 1;
> +   viewmode = 0;
> need_update = 1;
> return;
> }
> @@ -359,10 +367,18 @@ keyboard_callback(int ch)
> /* FALLTHROUGH */
> case 'h':
> show_help();
> +   sticky = 0;
> +   need_update = 1;
> +   break;
> +   case 'H':

Re: sndiod: allow mixing of duplex, record-only and play-only audio devices

2021-02-28 Thread Alexandre Ratchov
On Sat, Feb 27, 2021 at 09:59:21PM +, Edd Barrett wrote:
> 
> This is mostly a no-op for sndiod in the default configuration (except
> that play-only devices now accept recording clients). If you use
> alternative devices (-F), then it's possible for a record-only device to
> be found first, which may be confusing if you just want to hear sound.
> We can only assume that if you deviate from defaults, then you know what
> you are doing.

thanks for fixing this, ok ratchov



resolvd.8 typo

2021-02-28 Thread Scott Bennett
Probably meant 'sent' instead of 'send'

diff refs/heads/master refs/heads/dev
blob - b03e36a6a8e0513fa1e38a2f078bddb50a796f08
blob + 51b3c984faeeb83bfcd2d68370294690b15c659e
--- sbin/resolvd/resolvd.8
+++ sbin/resolvd/resolvd.8
@@ -34,7 +34,7 @@ read by the resolver routines in the C library.
 checks whether
 .Xr unwind 8
 is running and
-monitors the routing socket for proposals send by
+monitors the routing socket for proposals sent by
 .Xr dhclient 8 ,
 .Xr slaacd 8 ,
 or network devices which learn DNS information such as



systat(1) sticky help

2021-02-28 Thread Anindya Mukherjee
Hi,

I tend to keep systat(1) running in interactive mode, and find it very
useful to have the help line displayed permanently, i.e., not disappear
if a key is pressed or after a command is executed. The same goes for
the Ctrl-G display. For example, it tells me what modes are adjacent to
the currently active one when pressing left or right arrow keys.

The attached diff adds this feature. It is off by default. I noticed
that the 'h' key was not documented in the man page, so I took the
liberty of adding a line describing it.

Hope it is useful. Please have a look, thanks!

Regards,
Anindya

Index: engine.c
===
RCS file: /cvs/src/usr.bin/systat/engine.c,v
retrieving revision 1.27
diff -u -p -r1.27 engine.c
--- engine.c6 Feb 2021 06:19:28 -   1.27
+++ engine.c1 Mar 2021 03:20:41 -
@@ -70,6 +70,8 @@ volatile sig_atomic_t gotsig_alarm = 0;
 int need_update = 0;
 int need_sort = 0;
 int separate_thousands = 0;
+int viewmode = 0;
+int sticky = 0;
 
 SCREEN *screen;
 
@@ -1139,7 +1141,9 @@ command_set(struct command *cmd, const c
cmdbuf[0] = 0;
}
}
-   message_set(NULL);
+
+   if (!sticky)
+   message_set(NULL);
curr_cmd = cmd;
need_update = 1;
return prev;
@@ -1234,7 +1238,7 @@ keyboard(void)
return;
 
if (curr_message != NULL) {
-   if (ch > 0) {
+   if (ch > 0 && !sticky) {
message_set(NULL);
need_update = 1;
}
@@ -1359,8 +1363,15 @@ engine_loop(int countmax)
if (need_update) {
erase();
if (!averageonly ||
-   (averageonly && count == countmax - 1))
+   (averageonly && count == countmax - 1)) {
disp_update();
+   if (interactive && sticky) {
+   if (viewmode)
+   show_view();
+   else
+   show_help();
+   }
+   }
end_page();
need_update = 0;
if (countmax && ++count >= countmax)
Index: engine.h
===
RCS file: /cvs/src/usr.bin/systat/engine.h,v
retrieving revision 1.12
diff -u -p -r1.12 engine.h
--- engine.h12 Jan 2020 20:51:08 -  1.12
+++ engine.h1 Mar 2021 03:20:41 -
@@ -144,6 +144,8 @@ struct command *command_set(struct comma
 const char *message_set(const char *msg);
 
 void foreach_view(void (*callback)(field_view *));
+void show_help(void);
+void show_view(void);
 
 extern int sortdir;
 extern useconds_t udelay;
@@ -160,6 +162,8 @@ extern int columns, lines;
 extern int need_update;
 extern int need_sort;
 extern int separate_thousands;
+extern int viewmode;
+extern int sticky;
 
 extern volatile sig_atomic_t gotsig_close;
 extern volatile sig_atomic_t gotsig_resize;
Index: main.c
===
RCS file: /cvs/src/usr.bin/systat/main.c,v
retrieving revision 1.73
diff -u -p -r1.73 main.c
--- main.c  30 Jan 2021 08:44:42 -  1.73
+++ main.c  1 Mar 2021 03:20:41 -
@@ -285,6 +285,14 @@ cmd_compat(const char *buf)
 
if (strcasecmp(buf, "help") == 0) {
show_help();
+   sticky = 0;
+   need_update = 1;
+   return;
+   }
+   if (strcasecmp(buf, "stickyhelp") == 0) {
+   show_help();
+   sticky = 1;
+   viewmode = 0;
need_update = 1;
return;
}
@@ -359,10 +367,18 @@ keyboard_callback(int ch)
/* FALLTHROUGH */
case 'h':
show_help();
+   sticky = 0;
+   need_update = 1;
+   break;
+   case 'H':
+   show_help();
+   sticky = 1;
+   viewmode = 0;
need_update = 1;
break;
case CTRL_G:
show_view();
+   viewmode = 1;
need_update = 1;
break;
case 'l':
Index: systat.1
===
RCS file: /cvs/src/usr.bin/systat/systat.1,v
retrieving revision 1.119
diff -u -p -r1.119 systat.1
--- systat.122 Jun 2020 13:17:54 -  1.119
+++ systat.11 Mar 2021 03:20:41 -
@@ -175,6 +175,8 @@ line typed as a command.
 While entering a command the
 current character erase, word erase, and line kill characters
 may be used.
+.It Ic h
+Print the names of the available views on the command line.
 .It Ic o
 Select the 

wsmouse(4): user-defined touchpad tap button map

2021-02-28 Thread RJ Johnson
I recently posted a patch which allowed enabling/disabling touchpad tap
gestures [1]. After a lot of back and forth with bru@, I am now ready
to submit an updated version.

This version allows the user to map a tap gesture to a mouse button.
For mouse.tp.tapping, wsconsctl has been updated to accept a triple of
mouse buttons which corresponds to one-, two-, and three-finger tap
gestures, respectively. A tap gesture can be disabled by giving a value
of 0 for its mouse button. To not break existing configurations,
mouse.tp.tapping still accepts a single value and traslates it into a
button map which simulates the current mouse.tp.tapping behavior.

[1] https://marc.info/?l=openbsd-tech=161310033523558=2

Index: sbin/wsconsctl/mousecfg.c
===
RCS file: /cvs/src/sbin/wsconsctl/mousecfg.c,v
retrieving revision 1.7
diff -u -p -u -p -r1.7 mousecfg.c
--- sbin/wsconsctl/mousecfg.c   2 Apr 2020 17:17:04 -   1.7
+++ sbin/wsconsctl/mousecfg.c   26 Feb 2021 07:03:47 -
@@ -40,9 +40,9 @@
 #define TP_FILTER_FIRSTWSMOUSECFG_DX_MAX
 #define TP_FILTER_LAST WSMOUSECFG_SMOOTHING
 #define TP_FEATURES_FIRST  WSMOUSECFG_SOFTBUTTONS
-#define TP_FEATURES_LAST   WSMOUSECFG_TAPPING
+#define TP_FEATURES_LAST   WSMOUSECFG_DISABLE
 #define TP_SETUP_FIRST WSMOUSECFG_LEFT_EDGE
-#define TP_SETUP_LAST  WSMOUSECFG_TAP_LOCKTIME
+#define TP_SETUP_LAST  WSMOUSECFG_TAP_THREE_BTNMAP
 #define LOG_FIRST  WSMOUSECFG_LOG_INPUT
 #define LOG_LAST   WSMOUSECFG_LOG_EVENTS

@@ -71,8 +71,10 @@ static const int touchpad_types[] = {

 struct wsmouse_parameters cfg_tapping = {
(struct wsmouse_param[]) {
-   { WSMOUSECFG_TAPPING, 0 }, },
-   1
+   { WSMOUSECFG_TAP_ONE_BTNMAP, 0 },
+   { WSMOUSECFG_TAP_TWO_BTNMAP, 0 },
+   { WSMOUSECFG_TAP_THREE_BTNMAP, 0 }, },
+   3
 };

 struct wsmouse_parameters cfg_scaling = {
@@ -262,6 +264,30 @@ set_percent(struct wsmouse_parameters *f
 }

 static int
+set_tapping(struct wsmouse_parameters *field, char *tapping)
+{
+   int i1, i2, i3;
+
+   switch (sscanf(tapping, "%d,%d,%d", , , )) {
+   case 1:
+   if (i1 == 0) /* Disable */
+   i2 = i3 = i1;
+   else { /* Enable with defaults */
+   i1 = 1; /* Left click */
+   i2 = 3; /* Right click */
+   i3 = 2; /* Middle click */
+   }
+   /* FALLTHROUGH */
+   case 3:
+   set_value(field, WSMOUSECFG_TAP_ONE_BTNMAP, i1);
+   set_value(field, WSMOUSECFG_TAP_TWO_BTNMAP, i2);
+   set_value(field, WSMOUSECFG_TAP_THREE_BTNMAP, i3);
+   return (0);
+   }
+   return (-1);
+}
+
+static int
 set_edges(struct wsmouse_parameters *field, char *edges)
 {
float f1, f2, f3, f4;
@@ -359,6 +385,12 @@ mousecfg_rd_field(struct wsmouse_paramet
if (field == _param) {
if (read_param(field, val))
errx(1, "invalid input (param)");
+   return;
+   }
+
+   if (field == _tapping) {
+   if (set_tapping(field, val))
+   errx(1, "invalid input (tapping)");
return;
}

Index: share/man/man4/wsmouse.4
===
RCS file: /cvs/src/share/man/man4/wsmouse.4,v
retrieving revision 1.20
diff -u -p -u -p -r1.20 wsmouse.4
--- share/man/man4/wsmouse.44 Feb 2018 20:29:59 -   1.20
+++ share/man/man4/wsmouse.426 Feb 2021 07:03:46 -
@@ -26,7 +26,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd $Mdocdate: February 4 2018 $
+.Dd $Mdocdate: February 23 2021 $
 .Dt WSMOUSE 4
 .Os
 .Sh NAME
@@ -87,13 +87,24 @@ is omitted, commands apply to
 .Pa /dev/wsmouse0 .
 .Bl -tag -width Ds
 .It Cm mouse.tp.tapping
-Setting this parameter to a non-zero value enables tap gestures.
-Contacts on the touchpad that are immediately released again
-trigger click events.
-One-finger, two-finger, and three-finger taps generate left-button,
-right-button, and middle-button clicks, respectively.
-If, within a short time interval, a second touch follows a one-finger
-tap, the button-up event is not issued until that touch ends
+Contacts on the touchpad that are immediately released again can
+be mapped to mouse button clicks. This list of three parameters
+configures these mappings, in the order:
+.Bd -literal -offset indent
+.Sm off
+.Ar one-finger , two-finger , three-finger
+.Sm on
+.Ed
+.Pp
+Setting a parameter to a positive value enables that tap gesture
+and maps it to the given mouse button. To disable all three tap
+gestures at once, provide the single value of 0. Conversely, a
+single non-zero value will enable one-finger, two-finger, and
+three-finger tap gestures with their 

Re: Fix assigning array variables in ksh

2021-02-28 Thread Jordan Geoghegan


On 2/21/21 11:04 AM, Vadim Zhukov wrote:
> Hello all.
>
> This continues the 'Another potential ksh bug?' thread on misc@:
> https://marc.info/?l=openbsd-misc=160736700220621=2
> This present is a bit too late for Christmas, but at least the Day of
> Red Army is coming soon. I'm sure noone is against this patch then.
>
> The code in typeset() function, which is responsible for almost all
> shell variable tweaking, contains a bug: in case of array it passes
> "foo=var" instead of only variable name ("foo"), if the value was
> ever given. This results in, e.g., a bug reported by Jordan Geoghegan.
> Generally speaking, we had creating a (temporary) variable via global()
> in vpbase, and of course it didn't get the read-only marker.
>
> This fix is to use 'tvar' variable, which always contains shell
> variable name, without value.
>
> As a bonus, this fixes the ifs.t:IFS-null-1 test (previously failing).
> I'm too lazy to check why. :-)
>
> Okay anyone?
>
> --
> WBR,
>   Vadim Zhukov
>
>
> Index: regress/bin/ksh/obsd-regress.t
> ===
> RCS file: /cvs/src/regress/bin/ksh/obsd-regress.t,v
> retrieving revision 1.10
> diff -u -p -r1.10 obsd-regress.t
> --- regress/bin/ksh/obsd-regress.t8 Dec 2018 21:03:51 -   1.10
> +++ regress/bin/ksh/obsd-regress.t21 Feb 2021 18:51:54 -
> @@ -503,3 +503,16 @@ description:
>  stdin:
>   kill -s SIGINFO $$
>  ---
> +
> +name: overwrite-ro-array
> +description:
> + do not allow to override first element of a read-only array
> + via the non-array access.
> +stdin:
> + arr[0]=foo
> + readonly arr
> + arr=bar
> +expected-exit: e == 1
> +expected-stderr-pattern:
> + /: arr: is read only$/
> +---
> Index: bin/ksh/var.c
> ===
> RCS file: /cvs/src/bin/ksh/var.c,v
> retrieving revision 1.71
> diff -u -p -r1.71 var.c
> --- bin/ksh/var.c 21 Feb 2020 18:21:23 -  1.71
> +++ bin/ksh/var.c 21 Feb 2021 18:51:54 -
> @@ -644,7 +644,7 @@ typeset(const char *var, int set, int cl
>   global(tvar);
>   set &= ~(LOCAL|LOCAL_COPY);
>  
> - vpbase = (vp->flag & ARRAY) ? global(arrayname(var)) : vp;
> + vpbase = (vp->flag & ARRAY) ? global(arrayname(tvar)) : vp;
>  
>   /* only allow export flag to be set.  at ksh allows any attribute to
>* be changed, which means it can be truncated or modified
>

Hi Vadim,

I just tried this patch out and it appears to fix the issue -- thanks! I tried 
running a few large shell scripts that make use of arrays and everything worked 
as expected.

I don't have the authority to give you an ok, but I would certainly like to see 
this patch accepted.

Regards,

Jordan



Re: veb(4) support for vmd(8)?

2021-02-28 Thread David Gwynne



> On 27 Feb 2021, at 10:11, Klemens Nanni  wrote:
> 
> On Sat, Feb 27, 2021 at 09:44:03AM +1000, David Gwynne wrote:
>> 
>> 
>>> On 27 Feb 2021, at 7:50 am, Klemens Nanni  wrote:
>>> 
>>> On Sat, Feb 27, 2021 at 07:30:56AM +1000, David Gwynne wrote:
 i think this is enough to let vmd wire guests up to veb interfaces.
>>> But please update vm.conf(5) to mention veb(4) and vport(4) in as well
>>> SWITCH CONFIGURATION.
>> 
>> How would you fit wording about vport(4) in?
> I was too vague, it'd be just veb(4), I guess.
> I wouldn't go into any of the bridge/switch driver's specific
> configuration in vmd(8), i.e. explicitly omit any mention of vether(4)
> or vport(4).
> 
> How about this (quietly moving vmctl(8) from bridge(4) to veb(4) while
> at it...)

reads good to me, so ok. i'll put the .c bits in now.

> 
> 
> Index: vmd/vm.conf.5
> ===
> RCS file: /cvs/src/usr.sbin/vmd/vm.conf.5,v
> retrieving revision 1.55
> diff -u -p -r1.55 vm.conf.5
> --- vmd/vm.conf.5 23 Sep 2020 19:18:18 -  1.55
> +++ vmd/vm.conf.5 27 Feb 2021 00:07:20 -
> @@ -376,9 +376,10 @@ Set the owner to the specified group.
> .Sh SWITCH CONFIGURATION
> A virtual switch allows VMs to communicate with other network interfaces on 
> the
> host system via either
> -.Xr bridge 4
> +.Xr bridge 4 ,
> +.Xr switch 4
> or
> -.Xr switch 4 .
> +.Xr veb 4 .
> The network interface for each virtual switch defined in
> .Nm
> is pre-configured using
> @@ -435,9 +436,10 @@ as described in
> .Xr ifconfig 8 .
> .It Cm interface Ar name
> Set the
> +.Xr bridge 4 ,
> .Xr switch 4
> or
> -.Xr bridge 4
> +.Xr veb 4
> network interface of this switch.
> If the type is changed to
> .Ar switch0 ,
> Index: vmctl/vmctl.8
> ===
> RCS file: /cvs/src/usr.sbin/vmctl/vmctl.8,v
> retrieving revision 1.72
> diff -u -p -r1.72 vmctl.8
> --- vmctl/vmctl.8 16 Feb 2020 11:03:25 -  1.72
> +++ vmctl/vmctl.8 27 Feb 2021 00:07:41 -
> @@ -280,7 +280,7 @@ This tap/vio interface mapping
> allows guest network traffic to be manipulated by the host.
> Any valid host-side interface configuration may be performed on these
> tap interfaces, such as bridging (via
> -.Xr bridge 4 ) ,
> +.Xr veb 4 ) ,
> or using
> .Xr pf 4
> nat-to rules to create private or host-side NATed networks, as desired.
> @@ -423,7 +423,7 @@ Terminate VM number 1:
> # vmctl stop 1
> .Ed
> .Sh SEE ALSO
> -.Xr bridge 4 ,
> +.Xr veb 4 ,
> .Xr pf 4 ,
> .Xr tap 4 ,
> .Xr vio 4 ,



Re: sndiod: allow mixing of duplex, record-only and play-only audio devices

2021-02-28 Thread Matthias Schmidt
Hi Edd,

* Edd Barrett wrote:
> Hi,
> 
> Currently sndiod does not allow you to use alternative devices (-F
> devices) which support only a subset of the modes of the main (-f)
> device.
> 
> For example, if you do `sndiod -f rsnd/0 -F rsnd/1` and:
>  - rsnd/0 is full-duplex (rec + play).
>  - rsnd/1 is play-only.
> 
> Then you will be unable to use rsnd/1 as sndiod deems is incompatible
> and refuses to use it (similarly if rsnd/1 is record-only).

I am having exactly such a setup here. rsnd/0 is the internal speaker of
my Thinkpad T450s and rsnd/1 is a speaker connected via a Bluetooth
dongle.

> This is annoying. It means if you want to use a record-only or play-only
> device, you will either have to kill sndiod and restart it specifying
> only that device (`sndiod -f rsnd/1` for the above example), or failing
> that, downgrade the functionality of the main device (`-m play`).
> 
> This diff (a joint effort between ratchov@ and myself) makes mixing
> devices with different modes possible. It does this by making both
> recording and playing available for all devices, even if the underlying
> hardware doesn't support both modes.
> 
> For example, if I try to record from a play-only device, then recording
> will succeed, but the captured PCM data will be pure silence. Similarly,
> if I try to play to a record-only device, then the audio stream will
> disappear into the ether.
> 
> This is mostly a no-op for sndiod in the default configuration (except
> that play-only devices now accept recording clients). If you use
> alternative devices (-F), then it's possible for a record-only device to
> be found first, which may be confusing if you just want to hear sound.
> We can only assume that if you deviate from defaults, then you know what
> you are doing.
> 
> Please test and let us know if it works for you.

Works fine here and way better than before.  Switching from internal to
the external speakers was kind of a hassle and often ended up in me
restarting sndiod.  With the patch, switching worked as one would expect
it.

Cheers

Matthias



harmonize maxusers on 64-bit platforms

2021-02-28 Thread Miod Vallat
The following diff causes all 64-bit platforms to use the same maxusers
settings. (which in turn affects the maxprocess, maxthread, maxfiles and
initialvnodes kernel variables)

Index: sys/arch/alpha/conf/files.alpha
===
RCS file: /OpenBSD/src/sys/arch/alpha/conf/files.alpha,v
retrieving revision 1.107
diff -u -p -r1.107 files.alpha
--- sys/arch/alpha/conf/files.alpha 14 Feb 2018 23:51:49 -  1.107
+++ sys/arch/alpha/conf/files.alpha 28 Feb 2021 17:36:45 -
@@ -6,7 +6,7 @@
 # maxpartitions must be first item in files.${ARCH}
 maxpartitions 16
 
-maxusers 2 8 128
+maxusers 2 16 128
 
 # this loses, but there's no way to define attributes which have attributes
 define alpha_shared_intr
Index: sys/arch/arm64/conf/files.arm64
===
RCS file: /OpenBSD/src/sys/arch/arm64/conf/files.arm64,v
retrieving revision 1.32
diff -u -p -r1.32 files.arm64
--- sys/arch/arm64/conf/files.arm64 25 Jul 2020 12:26:09 -  1.32
+++ sys/arch/arm64/conf/files.arm64 28 Feb 2021 17:36:45 -
@@ -1,7 +1,7 @@
 # $OpenBSD: files.arm64,v 1.32 2020/07/25 12:26:09 tobhe Exp $
 
 maxpartitions  16
-maxusers   2 8 128
+maxusers   2 16 128
 
 major  {wd = 16}
 major  {sd = 24}
Index: sys/arch/loongson/conf/GENERIC
===
RCS file: /OpenBSD/src/sys/arch/loongson/conf/GENERIC,v
retrieving revision 1.64
diff -u -p -r1.64 GENERIC
--- sys/arch/loongson/conf/GENERIC  4 Feb 2021 16:25:39 -   1.64
+++ sys/arch/loongson/conf/GENERIC  28 Feb 2021 17:36:45 -
@@ -11,7 +11,7 @@
 
 machineloongson mips64
 include"../../../conf/GENERIC"
-maxusers   32
+maxusers   80
 
 option CPU_LOONGSON2
 option CPU_LOONGSON3
Index: sys/arch/loongson/conf/files.loongson
===
RCS file: /OpenBSD/src/sys/arch/loongson/conf/files.loongson,v
retrieving revision 1.26
diff -u -p -r1.26 files.loongson
--- sys/arch/loongson/conf/files.loongson   30 Sep 2020 22:23:41 -  
1.26
+++ sys/arch/loongson/conf/files.loongson   28 Feb 2021 17:36:45 -
@@ -2,7 +2,7 @@
 
 # Standard stanzas config(8) can't run without
 maxpartitions 16
-maxusers 2 8 64
+maxusers 2 16 128
 
 # Major number for block devices, for ``root on'' lines
 major  { sd = 0 }
Index: sys/arch/octeon/conf/GENERIC
===
RCS file: /OpenBSD/src/sys/arch/octeon/conf/GENERIC,v
retrieving revision 1.58
diff -u -p -r1.58 GENERIC
--- sys/arch/octeon/conf/GENERIC4 Feb 2021 16:25:39 -   1.58
+++ sys/arch/octeon/conf/GENERIC28 Feb 2021 17:36:45 -
@@ -11,7 +11,7 @@
 
 machineocteon mips64
 include"../../../conf/GENERIC"
-maxusers   32
+maxusers   80
 
 option CPU_MIPS64R2
 option CPU_OCTEON
Index: sys/arch/octeon/conf/files.octeon
===
RCS file: /OpenBSD/src/sys/arch/octeon/conf/files.octeon,v
retrieving revision 1.58
diff -u -p -r1.58 files.octeon
--- sys/arch/octeon/conf/files.octeon   25 Oct 2020 10:31:33 -  1.58
+++ sys/arch/octeon/conf/files.octeon   28 Feb 2021 17:36:45 -
@@ -2,7 +2,7 @@
 
 # Standard stanzas config(8) can't run without
 maxpartitions 16
-maxusers 2 8 64
+maxusers 2 16 128
 
 # Major number for block devices, for ``root on'' lines
 major  { sd = 0 }
Index: sys/arch/powerpc64/conf/files.powerpc64
===
RCS file: /OpenBSD/src/sys/arch/powerpc64/conf/files.powerpc64,v
retrieving revision 1.26
diff -u -p -r1.26 files.powerpc64
--- sys/arch/powerpc64/conf/files.powerpc64 23 Jan 2021 12:10:08 -  
1.26
+++ sys/arch/powerpc64/conf/files.powerpc64 28 Feb 2021 17:36:45 -
@@ -1,7 +1,7 @@
 # $OpenBSD: files.powerpc64,v 1.26 2021/01/23 12:10:08 kettenis Exp $
 
 maxpartitions  16
-maxusers   2 8 128
+maxusers   2 16 128
 
 major  {rd = 2}
 major  {sd = 3}
Index: sys/arch/sgi/conf/GENERIC-IP22
===
RCS file: /OpenBSD/src/sys/arch/sgi/conf/GENERIC-IP22,v
retrieving revision 1.18
diff -u -p -r1.18 GENERIC-IP22
--- sys/arch/sgi/conf/GENERIC-IP22  14 Feb 2018 23:51:49 -  1.18
+++ sys/arch/sgi/conf/GENERIC-IP22  28 Feb 2021 17:36:45 -
@@ -13,7 +13,7 @@
 
 machinesgi mips64
 include"../../../conf/GENERIC"
-maxusers   32  # Estimated number of users
+maxusers   80  # Estimated number of users
 
 # Make options
 makeoption LINK_ADDRESS="0x8880"
Index: sys/arch/sgi/conf/GENERIC-IP26
===
RCS file: 

Re: [OpenBSD -current] Change event timer in main loop with kqueue

2021-02-28 Thread martin mag
 Visa Hankala wrote (patch truncated):
> The kernel does not reschedule the timer when the user changes the
> timeout period. The new period will take effect only after the current
> period has expired. This is not explained in the manual page, though.
>
> With the recent kqueue changes, it is straightforward to make the kernel
> modify an existing timer. I think the clearest behaviour is to reset the
> timer completely when it is modified. If there are pending events, they
> should be cancelled because they do not necessarily correspond to the
> new settings.
>
> When f_modify and f_process are present in kqread_filtops, filt_timer
> is not used. filt_timerexpire() activates timer knotes directly using
> knote_activate() instead of KNOTE().
>
> However, the current behaviour has been around so long that one can
> argue that it is an actual feature. BSDs are not consistent with this,
> though. FreeBSD resets the timer immediately, whereas NetBSD and
> DragonFly BSD apply the new period after expiry.
>
> I guess the resetting is harmless in most cases but might wreak havoc
> at least with software that keeps poking its timers before expiry.
> ... PATCH TRUNCATED ...

Thank you very much for your response. I won't be of much help on this
tech mailing list as I've just started using OpenBSD as my daily OS.
Still, I tried to apply your patch yesterday but my issue is still there.
Maybe I did not apply it correctly? Or maybe I'm not understanding very
well how kqueue should work and I should revert to using EV_ONESHOT
when an EVFILT_TIMER is to be modified inside loop?

One other question (related) with modifying events inside main loop: If only ONE
monitored event is to be changed, it is NOT possible to ONLY register THAT ONE
event to the queue right?

For example:
.
count=0;
TIMER1=201;
BATT1 = open("/dev/apm", O_RDONLY);

EV_SET([0], TIMER1, EVFILT_TIMER, EV_ADD | EV_ENABLE, 0, 5000, NULL);
EV_SET([1], BATT1, EVFILT_READ, EV_ADD | EV_ENABLE | EV_CLEAR, 0, 0, NULL);
kevent(kq, ch, 2, NULL, 0, NULL);

for (;;){
nev = kevent(kq, NULL, 0, ev, 2, NULL);
for (int i=0; i you always get for the same very first event retrieved:
  APM_EVENT_TYPE(ev[i].data) = 0
which according to source, is a NOT EVENT equivalent.
  --> After retrieving that first event, you should receive other events such as
POWER_CHANGE (and no more that very first one).

However, if using the example above, you will ONLY receive events of type
NO_EVENT as the monitored events seem to be reset with the last
example line (executed at every iteration), disregarding it it was modified or
not.

Any idea of how to solve both those issues (apart from using multiple kqueues
with threads)? Is there a way to only register changed events, leaving
the others
untouched? (I guess I would still have the same issues if using
libev / libevent / libuv, as the backend is kqueue right?)

Thank you very much



Re: Teach rpki-client some https

2021-02-28 Thread Theo Buehler
On Sun, Feb 28, 2021 at 09:09:05AM +0100, Theo Buehler wrote:

> > +   if (error == EAI_SERVICE)
> > +   error = getaddrinfo(host, "443", , >res0);
> > +   if (error) {
> 
> error != NULL

Apologies, forgot to delete that.



Re: Teach rpki-client some https

2021-02-28 Thread Theo Buehler
On Thu, Feb 25, 2021 at 05:03:19PM +0100, Claudio Jeker wrote:
> On Fri, Feb 19, 2021 at 07:10:02PM +0100, Claudio Jeker wrote:
> > Some TAL files now include an https URI where the TA can be fetched from.
> > With this diff rpki-client will download the TA from https unless that
> > fails and then fall back to rsync.
> > 
> > This is not yet perfect but the diff is already large enough (adding a
> > full event based https client based on ftp codebase). For RRDP more a lot
> > more is required and I probably will refactor the main.c code then.
> > 
> > At the moment this adds a local mkostempat() function to implement
> > mkostemp() but with openat() instead of open(). I hope in the future libc
> > will provide something.
> > 
> > Thanks in advance for all the feedback
> 
> Updated diff. I found some bugs in the http.c code base regarding
> conncetion failures (because of unreachable IPv6 on the server) and fixed
> redirects. Those should now be fixed.

A couple of comments inline. Some cosmetic, some minor bugs.

Apart from a return value glitch for tls_close() the libtls handling
looks correct to me and while I'm not a http expert, the state machine
makes sense. The string handling (chopping up and re-encoding) looks
correct with appropriate bounds checking. I spent quite a bit of time
going through it.

Take from my comments whatever you like/makes sense, but I'm ok with
landing this and improving in tree.

> 
> -- 
> :wq Claudio
> 
> Index: Makefile
> ===
> RCS file: /cvs/src/usr.sbin/rpki-client/Makefile,v
> retrieving revision 1.18
> diff -u -p -r1.18 Makefile
> --- Makefile  4 Feb 2021 08:10:24 -   1.18
> +++ Makefile  19 Feb 2021 14:21:08 -
> @@ -1,13 +1,14 @@
>  #$OpenBSD: Makefile,v 1.18 2021/02/04 08:10:24 claudio Exp $
>  
>  PROG=rpki-client
> -SRCS=as.c cert.c cms.c crl.c gbr.c io.c ip.c log.c main.c mft.c 
> mkdir.c \
> - output.c output-bgpd.c output-bird.c output-csv.c output-json.c \
> - parser.c roa.c rsync.c tal.c validate.c x509.c
> +SRCS=as.c cert.c cms.c crl.c gbr.c http.c io.c ip.c log.c main.c 
> mft.c \
> + mkdir.c mkostempat.c output.c output-bgpd.c output-bird.c \
> + output-csv.c output-json.c parser.c roa.c rsync.c tal.c validate.c \
> + x509.c
>  MAN= rpki-client.8
>  
> -LDADD+= -lcrypto -lutil
> -DPADD+= ${LIBCRYPTO} ${LIBUTIL}
> +LDADD+= -ltls -lssl -lcrypto -lutil
> +DPADD+= ${LIBTLS} ${LIBSSL} ${LIBCRYPTO} ${LIBUTIL}
>  
>  CFLAGS+= -Wall -I${.CURDIR}
>  CFLAGS+= -Wstrict-prototypes -Wmissing-prototypes
> Index: extern.h
> ===
> RCS file: /cvs/src/usr.sbin/rpki-client/extern.h,v
> retrieving revision 1.47
> diff -u -p -r1.47 extern.h
> --- extern.h  22 Feb 2021 09:46:05 -  1.47
> +++ extern.h  23 Feb 2021 10:36:38 -
> @@ -399,6 +399,10 @@ void  proc_parser(int) __attribute__((n
>  char *rsync_base_uri(const char *);
>  void  proc_rsync(char *, char *, int) __attribute__((noreturn));
>  
> +/* Http-specific. */
> +
> +void  proc_http(char *, int);
> +
>  /* Logging (though really used for OpenSSL errors). */
>  
>  void  cryptowarnx(const char *, ...)
> @@ -417,6 +421,7 @@ void   io_str_buffer(struct ibuf *, cons
>  void  io_simple_read(int, void *, size_t);
>  void  io_buf_read_alloc(int, void **, size_t *);
>  void  io_str_read(int, char **);
> +int   io_recvfd(int, void *, size_t);
>  
>  /* X509 helpers. */
>  
> @@ -450,6 +455,7 @@ void  logx(const char *fmt, ...)
>   __attribute__((format(printf, 1, 2)));
>  
>  int  mkpathat(int, const char *);
> +int  mkostempat(int, char *, int);
>  
>  #define  RPKI_PATH_OUT_DIR   "/var/db/rpki-client"
>  #define  RPKI_PATH_BASE_DIR  "/var/cache/rpki-client"
> Index: http.c
> ===
> RCS file: http.c
> diff -N http.c
> --- /dev/null 1 Jan 1970 00:00:00 -
> +++ http.c24 Feb 2021 20:03:25 -
> @@ -0,0 +1,1226 @@
> +/*  $OpenBSD$  */
> +/*
> + * Copyright (c) 2020 Nils Fisher 
> + * Copyright (c) 2020 Claudio Jeker 
> + *
> + * 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