Re: sndio: protocol change - diff to test

2012-10-30 Thread Jonathan Gray
On Sun, Oct 28, 2012 at 01:55:34PM +0100, Alexandre Ratchov wrote:
> On Sat, Oct 27, 2012 at 03:14:07PM +0200, Alexandre Ratchov wrote:
> > Hi,
> > 
> > This diff is to use dedicated messages for flow control instead of
> > abusing clock tick messages and to enable flow control for MIDI.
> > There should be no change in behaviour, but this change is
> > necessary for future developpement of sndiod.
> > 
> > any regression? ok?
> > 
> 
> sorry; the previous diff is wrong, please consider the one
> below (thanks jsg@)

There seems to be some compat issue, before I restarted sndiod 44khz
audio was playing at what sounded like the system/hardware 48khz without
conversion.  After restarting sndiod it was fine though.

A quick midi test seems to reveal no problems, sysex messages still come
through, timing sounds right.



[PATCH] cwm: function menu

2012-10-30 Thread Kent R. Spillner
Howdy-

Here is an initial attempt at adding a menu for searching/executing internal
functions.  It's useful for those times you want to an unbound function, and
even when the function is bound to some key combo you haven't memorized yet
it can be faster than looking up the keybinding in the manual.  It also
plays really nicely with the restart diff from earlier today as I found out
while working on kbfunc_func_search itself. ;)

I'll work on the manpage bits on the train tonight.

Thanks in advance!

Best,
Kent


Index: calmwm.h
===
RCS file: /cvs/xenocara/app/cwm/calmwm.h,v
retrieving revision 1.153
diff -p -u -r1.153 calmwm.h
--- calmwm.h9 Sep 2012 19:47:47 -   1.153
+++ calmwm.h30 Oct 2012 20:21:59 -
@@ -225,6 +225,13 @@ struct screen_ctx {
 };
 TAILQ_HEAD(screen_ctx_q, screen_ctx);
 
+struct func {
+   char*tag;
+   void (*handler)(struct client_ctx *, union arg *);
+   int  flags;
+   union argargument;
+};
+
 struct keybinding {
TAILQ_ENTRY(keybinding)  entry;
void(*callback)(struct client_ctx *, union arg *);
@@ -393,6 +400,7 @@ void kbfunc_client_vmaximize(struct 
c
 union arg *);
 voidkbfunc_cmdexec(struct client_ctx *, union arg *);
 voidkbfunc_exec(struct client_ctx *, union arg *);
+voidkbfunc_func_search(struct client_ctx *, union arg *);
 voidkbfunc_lock(struct client_ctx *, union arg *);
 voidkbfunc_menu_search(struct client_ctx *, union arg *);
 voidkbfunc_moveresize(struct client_ctx *, union arg *);
@@ -501,6 +509,7 @@ extern CursorCursor_resize;
 extern struct screen_ctx_q  Screenq;
 extern struct client_ctx_q  Clientq;
 extern struct conf  Conf;
+extern struct func  name_to_kbfunc[];
 
 extern int  HasXinerama, HasRandr, Randr_ev;
 
Index: conf.c
===
RCS file: /cvs/xenocara/app/cwm/conf.c,v
retrieving revision 1.100
diff -p -u -r1.100 conf.c
--- conf.c  29 Oct 2012 19:46:03 -  1.100
+++ conf.c  30 Oct 2012 20:21:59 -
@@ -127,6 +127,7 @@ static struct {
{ "M-Up",   "raise" },
{ "M-slash","search" },
{ "C-slash","menusearch" },
+   { "CM-slash",   "funcsearch" },
{ "M-Tab",  "cycle" },
{ "MS-Tab", "rcycle" },
{ "CM-n",   "label" },
@@ -312,15 +313,11 @@ conf_client(struct client_ctx *cc)
cc->flags |= ignore ? CLIENT_IGNORE : 0;
 }
 
-static struct {
-   char*tag;
-   void (*handler)(struct client_ctx *, union arg *);
-   int  flags;
-   union argargument;
-} name_to_kbfunc[] = {
+struct func name_to_kbfunc[] = {
{ "lower", kbfunc_client_lower, KBFLAG_NEEDCLIENT, {0} },
{ "raise", kbfunc_client_raise, KBFLAG_NEEDCLIENT, {0} },
{ "search", kbfunc_client_search, 0, {0} },
+   { "funcsearch", kbfunc_func_search, KBFLAG_NEEDCLIENT, {0} },
{ "menusearch", kbfunc_menu_search, 0, {0} },
{ "hide", kbfunc_client_hide, KBFLAG_NEEDCLIENT, {0} },
{ "cycle", kbfunc_client_cycle, 0, {.i = CWM_CYCLE} },
@@ -427,6 +424,7 @@ static struct {
{.i = (CWM_LEFT|CWM_PTRMOVE|CWM_BIGMOVE)} },
{ "bigptrmoveright", kbfunc_moveresize, 0,
{.i = (CWM_RIGHT|CWM_PTRMOVE|CWM_BIGMOVE)} },
+   { NULL, NULL, 0, {0} }
 };
 
 /*
Index: kbfunc.c
===
RCS file: /cvs/xenocara/app/cwm/kbfunc.c,v
retrieving revision 1.63
diff -p -u -r1.63 kbfunc.c
--- kbfunc.c9 Sep 2012 19:47:47 -   1.63
+++ kbfunc.c30 Oct 2012 20:21:59 -
@@ -173,6 +173,35 @@ kbfunc_client_search(struct client_ctx *
 }
 
 void
+kbfunc_func_search(struct client_ctx *cc, union arg *arg)
+{
+   struct screen_ctx   *sc = cc->sc;
+   struct func *func;
+   struct menu *mi;
+   struct menu_qmenuq;
+
+   TAILQ_INIT(&menuq);
+
+   for (func = name_to_kbfunc; func->tag != NULL; func++) {
+   mi = xcalloc(1, sizeof(*mi));
+   (void)strlcpy(mi->text, func->tag, sizeof(mi->text));
+   mi->ctx = func;
+   TAILQ_INSERT_TAIL(&menuq, mi, entry);
+   }
+
+   if ((mi = menu_filter(sc, &menuq, "function", NULL, 0,
+   search_match_text, NULL)) != NULL) {
+   func = (struct func *)mi->ctx;
+   (*func->handler)(cc, &func->argument);
+   }
+
+   while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
+   TAILQ_REMOVE(&menuq, mi, entry);
+   xfree(mi);
+ 

Re: cwm reload support

2012-10-30 Thread Kent R. Spillner
Howdy-

> > > It seems people do really use that. How about this diff?
> > > In short: do u_exec("cwm") in conf_reload(). This should probably be
> > > u_exec(somewhere-argv0-is-saved).
> > 
> > or use __progname ; also rename from 'reload' to 'restart'
> 
> I like this approach a lot.  Here's an update which also preserves
> Conf.conf_path and display_name.

Whoops, here's a better diff.  I manually removed some unrelated
hunks and forgot to fixup the line numbers.

Sorry! :(

Best,
Kent


Index: calmwm.h
===
RCS file: /cvs/xenocara/app/cwm/calmwm.h,v
retrieving revision 1.153
diff -p -u -r1.153 calmwm.h
--- calmwm.h9 Sep 2012 19:47:47 -   1.153
+++ calmwm.h30 Oct 2012 16:42:50 -
@@ -397,7 +397,7 @@ void kbfunc_lock(struct client_ctx 
*,
 voidkbfunc_menu_search(struct client_ctx *, union arg *);
 voidkbfunc_moveresize(struct client_ctx *, union arg *);
 voidkbfunc_quit_wm(struct client_ctx *, union arg *);
-voidkbfunc_reload(struct client_ctx *, union arg *);
+voidkbfunc_restart(struct client_ctx *, union arg *);
 voidkbfunc_ssh(struct client_ctx *, union arg *);
 voidkbfunc_term(struct client_ctx *, union arg *);
 
@@ -431,7 +431,6 @@ void conf_grab(struct conf *, 
struct 
 voidconf_grab_mouse(struct client_ctx *);
 voidconf_init(struct conf *);
 voidconf_mousebind(struct conf *, char *, char *);
-voidconf_reload(struct conf *);
 voidconf_setup(struct conf *, const char *);
 voidconf_ungrab(struct conf *, struct keybinding *);
 
@@ -449,7 +448,6 @@ void xev_loop(void);
 voidxu_btn_grab(Window, int, u_int);
 voidxu_btn_ungrab(Window, int, u_int);
 voidxu_configure(struct client_ctx *);
-voidxu_freecolor(struct screen_ctx *, unsigned long);
 voidxu_getatoms(void);
 unsigned long   xu_getcolor(struct screen_ctx *, char *);
 int xu_getprop(Window, Atom, Atom, long, u_char **);
Index: conf.c
===
RCS file: /cvs/xenocara/app/cwm/conf.c,v
retrieving revision 1.100
diff -p -u -r1.100 conf.c
--- conf.c  29 Oct 2012 19:46:03 -  1.100
+++ conf.c  30 Oct 2012 16:42:50 -
@@ -81,36 +81,8 @@ conf_color(struct conf *c, struct screen
 {
int  i;
 
-   for (i = 0; i < CWM_COLOR_MAX; i++) {
-   xu_freecolor(sc, sc->color[i].pixel);
+   for (i = 0; i < CWM_COLOR_MAX; i++)
sc->color[i].pixel = xu_getcolor(sc, c->color[i].name);
-   }
-}
-
-void
-conf_reload(struct conf *c)
-{
-   struct screen_ctx   *sc;
-   struct client_ctx   *cc;
-
-   if (parse_config(c->conf_path, c) == -1) {
-   warnx("config file %s has errors, not reloading", c->conf_path);
-   return;
-   }
-
-   TAILQ_FOREACH(sc, &Screenq, entry) {
-   conf_gap(c, sc);
-   conf_color(c, sc);
-   conf_font(c, sc);
-   menu_init(sc);
-   }
-   TAILQ_FOREACH(cc, &Clientq, entry) {
-   conf_client(cc);
-   /* XXX Does not take hmax/vmax into account. */
-   if ((cc->flags & CLIENT_MAXFLAGS) == CLIENT_MAXIMIZED)
-   cc->bwidth = 0;
-   client_draw_border(cc);
-   }
 }
 
 static struct {
@@ -148,7 +120,7 @@ static struct {
{ "CM-equal",   "vmaximize" },
{ "CMS-equal",  "hmaximize" },
{ "CMS-f",  "freeze" },
-   { "CMS-r",  "reload" },
+   { "CMS-r",  "restart" },
{ "CMS-q",  "quit" },
{ "M-h","moveleft" },
{ "M-j","movedown" },
@@ -375,7 +347,7 @@ static struct {
{ "vmaximize", kbfunc_client_vmaximize, KBFLAG_NEEDCLIENT, {0} },
{ "hmaximize", kbfunc_client_hmaximize, KBFLAG_NEEDCLIENT, {0} },
{ "freeze", kbfunc_client_freeze, KBFLAG_NEEDCLIENT, {0} },
-   { "reload", kbfunc_reload, 0, {0} },
+   { "restart", kbfunc_restart, 0, {0} },
{ "quit", kbfunc_quit_wm, 0, {0} },
{ "exec", kbfunc_exec, 0, {.i = CWM_EXEC_PROGRAM} },
{ "exec_wm", kbfunc_exec, 0, {.i = CWM_EXEC_WM} },
Index: cwm.1
===
RCS file: /cvs/xenocara/app/cwm/cwm.1,v
retrieving revision 1.47
diff -p -u -r1.47 cwm.1
--- cwm.1   9 May 2012 18:37:39 -   1.47
+++ cwm.1   30 Oct 2012 16:42:50 -
@@ -116,7 +116,8 @@ dialog; allows you to switch from
 .Nm
 to another window manager without restarting the X server.
 .It Ic CMS-r
-Reload configuration.
+Re

Re: bgpd filter and reload diff

2012-10-30 Thread Claudio Jeker
On Sun, Oct 28, 2012 at 01:26:42PM +0100, Claudio Jeker wrote:
> On Sat, Oct 13, 2012 at 08:40:35PM +0200, Claudio Jeker wrote:
> > Hi,
> > 
> > this is the first step in making bgpd faster and non locking on reloads.
> > The filters are now split into input and output chains. The input chains
> > are also split per RIB. This should result in faster filtering and allows
> > to only run softreconfig on those tables that need it. People with
> > multiple RIBs will benefit the most at the moment.
> > 
> > I did some basic tests and I'm fairly confident that it should work but
> > this is a huge change in the reload logic and needs a good broad testing
> > and I don't mind some review of the code.
> > 
> 
> No comments on this? Should I just commit it?
> 

OK, benno@ found an issue where the RDE was crashing. I think I found the
cause, there was a stupid off by one in one of the for loops.
This version should fix that.

-- 
:wq Claudio

Index: bgpd.h
===
RCS file: /cvs/src/usr.sbin/bgpd/bgpd.h,v
retrieving revision 1.273
diff -u -p -r1.273 bgpd.h
--- bgpd.h  18 Sep 2012 10:10:00 -  1.273
+++ bgpd.h  20 Sep 2012 08:06:06 -
@@ -103,6 +103,7 @@ enum reconf_action {
RECONF_NONE,
RECONF_KEEP,
RECONF_REINIT,
+   RECONF_RELOAD,
RECONF_DELETE
 };
 
Index: rde.c
===
RCS file: /cvs/src/usr.sbin/bgpd/rde.c,v
retrieving revision 1.321
diff -u -p -r1.321 rde.c
--- rde.c   18 Sep 2012 10:10:00 -  1.321
+++ rde.c   29 Oct 2012 07:16:51 -
@@ -85,12 +85,11 @@ void rde_dump_mrt_new(struct mrt *, pi
 voidrde_dump_done(void *);
 
 int rde_rdomain_import(struct rde_aspath *, struct rdomain *);
-voidrde_up_dump_upcall(struct rib_entry *, void *);
+voidrde_reload_done(void);
 voidrde_softreconfig_out(struct rib_entry *, void *);
 voidrde_softreconfig_in(struct rib_entry *, void *);
-voidrde_softreconfig_load(struct rib_entry *, void *);
-voidrde_softreconfig_load_peer(struct rib_entry *, void *);
 voidrde_softreconfig_unload_peer(struct rib_entry *, void *);
+voidrde_up_dump_upcall(struct rib_entry *, void *);
 voidrde_update_queue_runner(void);
 voidrde_update6_queue_runner(u_int8_t);
 
@@ -119,7 +118,7 @@ struct bgpd_config  *conf, *nconf;
 time_t  reloadtime;
 struct rde_peer_headpeerlist;
 struct rde_peer*peerself;
-struct filter_head *rules_l, *newrules;
+struct filter_head *out_rules, *out_rules_tmp;
 struct rdomain_head*rdomains_l, *newdomains;
 struct imsgbuf *ibuf_se;
 struct imsgbuf *ibuf_se_ctl;
@@ -224,10 +223,10 @@ rde_main(int pipe_m2r[2], int pipe_s2r[2
nexthop_init(nexthophashsize);
peer_init(peerhashsize);
 
-   rules_l = calloc(1, sizeof(struct filter_head));
-   if (rules_l == NULL)
+   out_rules = calloc(1, sizeof(struct filter_head));
+   if (out_rules == NULL)
fatal(NULL);
-   TAILQ_INIT(rules_l);
+   TAILQ_INIT(out_rules);
rdomains_l = calloc(1, sizeof(struct rdomain_head));
if (rdomains_l == NULL)
fatal(NULL);
@@ -645,11 +644,11 @@ rde_dispatch_imsg_parent(struct imsgbuf 
struct rde_rib   rn;
struct rde_peer *peer;
struct peer_config  *pconf;
+   struct filter_head  *nr;
struct filter_rule  *r;
struct filter_set   *s;
struct nexthop  *nh;
-   int  n, fd, reconf_in = 0, reconf_out = 0,
-reconf_rib = 0;
+   int  n, fd;
u_int16_trid;
 
if ((n = imsg_read(ibuf)) == -1)
@@ -693,10 +692,10 @@ rde_dispatch_imsg_parent(struct imsgbuf 
sizeof(struct bgpd_config))
fatalx("IMSG_RECONF_CONF bad len");
reloadtime = time(NULL);
-   newrules = calloc(1, sizeof(struct filter_head));
-   if (newrules == NULL)
+   out_rules_tmp = calloc(1, sizeof(struct filter_head));
+   if (out_rules_tmp == NULL)
fatal(NULL);
-   TAILQ_INIT(newrules);
+   TAILQ_INIT(out_rules_tmp);
newdomains = calloc(1, sizeof(struct rdomain_head));
if (newdomains == NULL)
fatal(NULL);
@@ -746,7 +745,19 @@ rde_dispatch_imsg_parent(struct imsgbuf 
TAILQ_INIT(&r->set);
r->peer.ribid = rib_find(r->rib);
parent_set = &r->set;
-   TAILQ_INSERT_TAIL(newrule

Re: In need of faster boxes

2012-10-30 Thread Dorian Büttner

Would someone be able to host 2 2U machines?
I could provide IBM X3650 M2 (Type code 7947) machines. 146Gig disks 
only, therefore some add'l RAM in exchange.

2 quad core Nehalems (2.9G) and red pwr.
If interested, I'd not complain if shipping could be funded?

Am 27.10.2012 10:49, schrieb Marc Espie:

My laptop is running out of computing power for what I'm doing.

I'm in need of faster boxes to run builds, a setup with two fast amd64
boxes would be good.

Is there anyone who can donate such a setup.
Robert@ is okay to host such servers, but they have to be 1U!
Cash donations would also work. But server donation + shipping is better.


Alternately, someone can host the machines instead of him.
What I would need:
- full console access over the net in case I break things (will happen).
- not too far network-wise from .fr
- at least 2 x 4 cores, over 2GHz, 6GB each or more (I intend to run
dpb builds out of ram if things work out, for instance)
- enough bandwidth to grab distfiles.
- reasonably fast disks, smaller stuff is okay (500GB per box these days ?)
- preferably alone on the machine. I will BREAK the base system (make problems
tend to do that). And I need to collect statistics such as build times
for various strategies.
- hardware that's supported by OpenBSD. The goal is not for me to fix hw
issues, especially since I'm not really a kernel hacker, and every hw problem
will mean time wasted not doing other useful stuff...

We are talking about a donation. I intend to fully rely on this for OpenBSD
work, so this is not something you lend one month, and then discover you
need the next month. (In particular, for long term statistics).




Re: cwm reload support

2012-10-30 Thread Kent R. Spillner
Hey, dude-

> > It seems people do really use that. How about this diff?
> > In short: do u_exec("cwm") in conf_reload(). This should probably be
> > u_exec(somewhere-argv0-is-saved).
> 
> or use __progname ; also rename from 'reload' to 'restart'

I like this approach a lot.  Here's an update which also preserves
Conf.conf_path and display_name.

Best,
Kent


Index: calmwm.h
===
RCS file: /cvs/xenocara/app/cwm/calmwm.h,v
retrieving revision 1.153
diff -p -u -r1.153 calmwm.h
--- calmwm.h9 Sep 2012 19:47:47 -   1.153
+++ calmwm.h30 Oct 2012 16:42:50 -
@@ -397,7 +401,7 @@ void kbfunc_lock(struct client_ctx 
*,
 voidkbfunc_menu_search(struct client_ctx *, union arg *);
 voidkbfunc_moveresize(struct client_ctx *, union arg *);
 voidkbfunc_quit_wm(struct client_ctx *, union arg *);
-voidkbfunc_reload(struct client_ctx *, union arg *);
+voidkbfunc_restart(struct client_ctx *, union arg *);
 voidkbfunc_ssh(struct client_ctx *, union arg *);
 voidkbfunc_term(struct client_ctx *, union arg *);
 
@@ -431,7 +435,6 @@ void conf_grab(struct conf *, 
struct 
 voidconf_grab_mouse(struct client_ctx *);
 voidconf_init(struct conf *);
 voidconf_mousebind(struct conf *, char *, char *);
-voidconf_reload(struct conf *);
 voidconf_setup(struct conf *, const char *);
 voidconf_ungrab(struct conf *, struct keybinding *);
 
@@ -449,7 +452,6 @@ void xev_loop(void);
 voidxu_btn_grab(Window, int, u_int);
 voidxu_btn_ungrab(Window, int, u_int);
 voidxu_configure(struct client_ctx *);
-voidxu_freecolor(struct screen_ctx *, unsigned long);
 voidxu_getatoms(void);
 unsigned long   xu_getcolor(struct screen_ctx *, char *);
 int xu_getprop(Window, Atom, Atom, long, u_char **);
Index: conf.c
===
RCS file: /cvs/xenocara/app/cwm/conf.c,v
retrieving revision 1.100
diff -p -u -r1.100 conf.c
--- conf.c  29 Oct 2012 19:46:03 -  1.100
+++ conf.c  30 Oct 2012 16:42:50 -
@@ -81,36 +81,8 @@ conf_color(struct conf *c, struct screen
 {
int  i;
 
-   for (i = 0; i < CWM_COLOR_MAX; i++) {
-   xu_freecolor(sc, sc->color[i].pixel);
+   for (i = 0; i < CWM_COLOR_MAX; i++)
sc->color[i].pixel = xu_getcolor(sc, c->color[i].name);
-   }
-}
-
-void
-conf_reload(struct conf *c)
-{
-   struct screen_ctx   *sc;
-   struct client_ctx   *cc;
-
-   if (parse_config(c->conf_path, c) == -1) {
-   warnx("config file %s has errors, not reloading", c->conf_path);
-   return;
-   }
-
-   TAILQ_FOREACH(sc, &Screenq, entry) {
-   conf_gap(c, sc);
-   conf_color(c, sc);
-   conf_font(c, sc);
-   menu_init(sc);
-   }
-   TAILQ_FOREACH(cc, &Clientq, entry) {
-   conf_client(cc);
-   /* XXX Does not take hmax/vmax into account. */
-   if ((cc->flags & CLIENT_MAXFLAGS) == CLIENT_MAXIMIZED)
-   cc->bwidth = 0;
-   client_draw_border(cc);
-   }
 }
 
 static struct {
@@ -148,7 +120,7 @@ static struct {
{ "CM-equal",   "vmaximize" },
{ "CMS-equal",  "hmaximize" },
{ "CMS-f",  "freeze" },
-   { "CMS-r",  "reload" },
+   { "CMS-r",  "restart" },
{ "CMS-q",  "quit" },
{ "M-h","moveleft" },
{ "M-j","movedown" },
@@ -375,7 +347,7 @@ static struct {
{ "vmaximize", kbfunc_client_vmaximize, KBFLAG_NEEDCLIENT, {0} },
{ "hmaximize", kbfunc_client_hmaximize, KBFLAG_NEEDCLIENT, {0} },
{ "freeze", kbfunc_client_freeze, KBFLAG_NEEDCLIENT, {0} },
-   { "reload", kbfunc_reload, 0, {0} },
+   { "restart", kbfunc_restart, 0, {0} },
{ "quit", kbfunc_quit_wm, 0, {0} },
{ "exec", kbfunc_exec, 0, {.i = CWM_EXEC_PROGRAM} },
{ "exec_wm", kbfunc_exec, 0, {.i = CWM_EXEC_WM} },
Index: cwm.1
===
RCS file: /cvs/xenocara/app/cwm/cwm.1,v
retrieving revision 1.47
diff -p -u -r1.47 cwm.1
--- cwm.1   9 May 2012 18:37:39 -   1.47
+++ cwm.1   30 Oct 2012 16:42:50 -
@@ -116,7 +116,8 @@ dialog; allows you to switch from
 .Nm
 to another window manager without restarting the X server.
 .It Ic CMS-r
-Reload configuration.
+Restart the running
+.Xr cwm 1 .
 .It Ic CMS-q
 Quit
 .Nm .
Index: cwmrc.5

Re: SIIG 4S PCIe 4-port Serial Card

2012-10-30 Thread William Ahern
On Fri, Oct 19, 2012 at 10:54:33PM +0100, Stuart Henderson wrote:

> My original mail about the chip (including diff) is at
> http://marc.info/?l=openbsd-tech&m=126446213208560&w=2, there is
> some problem I was unable to track down which prevents things from
> working when the port is set to the correct frequency, but setting
> to half the frequency gets a usable port, you just need to half
> the desired baud rate of the serial port (e.g. cu -s 4800 -l cua03).
> 
> Diff there won't apply directly as things have changed since then.
> 
> The pcidevs change might apply with patch but is simple enough to
> hand-apply; after doing this, run "make" in sys/dev/pci to update
> the pcidevs.h/pcidevs_data.h files.
> 
> The pucdata.c table has changed format since then to save memory,
> something like the below should be about right, you can't get the
> speed bang-on with the new table format (rather than recording
> actual speed it uses shorthand to allow multipliers or powers-of-two
> of the standard COM port UART frequency 1.8432MHz; the exact needed
> speed can't be stored in this notation but using a multiplier of 17
> should be close enough for other ports to lock onto it - if not
> then try 18). This version is untested though as I am lacking
> machines with PCIe slots that I can use for testing.

The patch worked as advertised and unedited. Many thanks.

I have a few days before this thing goes into the colo, so I'm free to
experiment a little. If you have any ideas you want to test out, feel free
to send me a patch.



Re: cwm reload support

2012-10-30 Thread Janne Johansson
2012/10/30 Okan Demirmen :
> will anyone miss reload support?  one can always re-exec cwm, or any
> other wm for a matter of fact.
>

I use cwm and will not miss reload.

-- 
 To our sweethearts and wives.  May they never meet. -- 19th century toast



ix(4): remove unused flow director code

2012-10-30 Thread Mike Belopuhov
Hi,

Flow director is described as "a large number of flow affinity
filters that direct receive packets by their flows to queues
for classification, load balancing, and matching between flows
and CPU cores."  As we don't support anything like this the code
(that is still compiled in but is not called) gets out-of date
quickly and in fact is completely rewritten in the upstream.

I suggest we remove it so that it doesn't get in the way and
once we'll need anything like that we'll pick up the latest
version from intel.

OK?

diff --git sys/dev/pci/if_ix.c sys/dev/pci/if_ix.c
index fec2f52..f7fc680 100644
--- sys/dev/pci/if_ix.c
+++ sys/dev/pci/if_ix.c
@@ -788,16 +788,7 @@ ixgbe_init(void *arg)
}
 #endif
 
-#ifdef IXGBE_FDIR
-   /* Init Flow director */
-   if (sc->hw.mac.type != ixgbe_mac_82598EB)
-   ixgbe_init_fdir_signature_82599(&sc->hw, fdir_pballoc);
-#endif
-
-   /*
-* Check on any SFP devices that
-* need to be kick-started
-*/
+   /* Check on any SFP devices that need to be kick-started */
if (sc->hw.phy.type == ixgbe_phy_none) {
err = sc->hw.phy.ops.identify(&sc->hw);
if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) {
diff --git sys/dev/pci/ixgbe.c sys/dev/pci/ixgbe.c
index a35c7ca..b3de111 100644
--- sys/dev/pci/ixgbe.c
+++ sys/dev/pci/ixgbe.c
@@ -370,205 +370,6 @@ int32_t ixgbe_clear_hw_cntrs_generic(struct ixgbe_hw *hw)
 }
 
 /**
- *  ixgbe_read_pba_string_generic - Reads part number string from EEPROM
- *  @hw: pointer to hardware structure
- *  @pba_num: stores the part number string from the EEPROM
- *  @pba_num_size: part number string buffer length
- *
- *  Reads the part number string from the EEPROM.
- **/
-int32_t ixgbe_read_pba_string_generic(struct ixgbe_hw *hw, uint8_t *pba_num,
- uint32_t pba_num_size)
-{
-   int32_t ret_val;
-   uint16_t data;
-   uint16_t pba_ptr;
-   uint16_t offset;
-   uint16_t length;
-
-   if (pba_num == NULL) {
-   DEBUGOUT("PBA string buffer was null\n");
-   return IXGBE_ERR_INVALID_ARGUMENT;
-   }
-
-   ret_val = hw->eeprom.ops.read(hw, IXGBE_PBANUM0_PTR, &data);
-   if (ret_val) {
-   DEBUGOUT("NVM Read Error\n");
-   return ret_val;
-   }
-
-   ret_val = hw->eeprom.ops.read(hw, IXGBE_PBANUM1_PTR, &pba_ptr);
-   if (ret_val) {
-   DEBUGOUT("NVM Read Error\n");
-   return ret_val;
-   }
-
-   /*
-* if data is not ptr guard the PBA must be in legacy format which
-* means pba_ptr is actually our second data word for the PBA number
-* and we can decode it into an ascii string
-*/
-   if (data != IXGBE_PBANUM_PTR_GUARD) {
-   DEBUGOUT("NVM PBA number is not stored as string\n");
-
-   /* we will need 11 characters to store the PBA */
-   if (pba_num_size < 11) {
-   DEBUGOUT("PBA string buffer too small\n");
-   return IXGBE_ERR_NO_SPACE;
-   }
-
-   /* extract hex string from data and pba_ptr */
-   pba_num[0] = (data >> 12) & 0xF;
-   pba_num[1] = (data >> 8) & 0xF;
-   pba_num[2] = (data >> 4) & 0xF;
-   pba_num[3] = data & 0xF;
-   pba_num[4] = (pba_ptr >> 12) & 0xF;
-   pba_num[5] = (pba_ptr >> 8) & 0xF;
-   pba_num[6] = '-';
-   pba_num[7] = 0;
-   pba_num[8] = (pba_ptr >> 4) & 0xF;
-   pba_num[9] = pba_ptr & 0xF;
-
-   /* put a null character on the end of our string */
-   pba_num[10] = '\0';
-
-   /* switch all the data but the '-' to hex char */
-   for (offset = 0; offset < 10; offset++) {
-   if (pba_num[offset] < 0xA)
-   pba_num[offset] += '0';
-   else if (pba_num[offset] < 0x10)
-   pba_num[offset] += 'A' - 0xA;
-   }
-
-   return IXGBE_SUCCESS;
-   }
-
-   ret_val = hw->eeprom.ops.read(hw, pba_ptr, &length);
-   if (ret_val) {
-   DEBUGOUT("NVM Read Error\n");
-   return ret_val;
-   }
-
-   if (length == 0x || length == 0) {
-   DEBUGOUT("NVM PBA number section invalid length\n");
-   return IXGBE_ERR_PBA_SECTION;
-   }
-
-   /* check if pba_num buffer is big enough */
-   if (pba_num_size  < (((uint32_t)length * 2) - 1)) {
-   DEBUGOUT("PBA string buffer too small\n");
-   return IXGBE_ERR_NO_SPACE;
-   }
-
-   /* trim pba length from start of string */
-   pba_ptr++;
-   length--;
-
-   for (offset = 0; offset < length; offset++) {
-   ret_val = hw->eeprom.ops.read(hw, pba_ptr + offset, &data);
-   if (ret_val) {
-   

Re: Goodbye to you my file descriptor

2012-10-30 Thread rustyBSD
Le 30/10/2012 15:32, Christiano F. Haesbaert a écrit :
> That should be an access(2) call.
Yes.Something like this - also moved len to size_t,
as strlen() is size_t:


--- dired.cWed Mar 14 14:56:35 2012
+++ dired.cTue Oct 30 16:23:00 2012
@@ -724,9 +724,10 @@
 dired_(char *dname)
 {
 struct buffer*bp;
-int len, i;
+int i;
+size_t len;
 
-if ((fopen(dname,"r")) == NULL) {
+if (access(dname, R_OK) == -1) {
 if (errno == EACCES)
 ewprintf("Permission denied");
 return (NULL);



Re: Goodbye to you my file descriptor

2012-10-30 Thread William Ahern
On Tue, Oct 30, 2012 at 11:57:05AM -0400, Okan Demirmen wrote:
> On Tue, Oct 30, 2012 at 11:53 AM, Christiano F. Haesbaert
>  wrote:
> > On 30 October 2012 16:52, Christiano F. Haesbaert
> >  wrote:
> >> On 30 October 2012 16:45, Okan Demirmen  wrote:
> >>> On Tue, Oct 30, 2012 at 10:32 AM, Christiano F. Haesbaert
> >>>  wrote:
>  On 30 October 2012 15:03, Christiano F. Haesbaert
>   wrote:

>  That should be an access(2) call.
> 
> >>>
> >>> or stat(2) due to tctu.
> >>
> >> I believe in that case it would be the same, since there is still a
> >> window between stat(2)/access(2) and open(2).
> >
> > I mean, considering he would open/stat/close and open again.
> 
> I didn't actually look at the code; I just noticed the words
> permission and access(2) and hit reply :)
> 

Perhaps you meant fstat? Looking at the code, it doesn't look like there's
any way to fix the TOCTOU issue without resorting to a complete overhaul,
and instead using the openat() family of calls. OTOH, it looks like the
permission check is just for sanity--early failure.



Re: Goodbye to you my file descriptor

2012-10-30 Thread Christiano F. Haesbaert
On 30 October 2012 16:57, Okan Demirmen  wrote:
> On Tue, Oct 30, 2012 at 11:53 AM, Christiano F. Haesbaert
>  wrote:
>> On 30 October 2012 16:52, Christiano F. Haesbaert
>>  wrote:
>>> On 30 October 2012 16:45, Okan Demirmen  wrote:
 On Tue, Oct 30, 2012 at 10:32 AM, Christiano F. Haesbaert
  wrote:
> On 30 October 2012 15:03, Christiano F. Haesbaert
>  wrote:
>> On 30 October 2012 15:00, Mike Belopuhov  wrote:
>>> On Tue, Oct 30, 2012 at 2:58 PM, Christiano F. Haesbaert
>>>  wrote:
 On 30 October 2012 14:36, rustyBSD  wrote:
> MMmhh...
>
> == /usr/src/usr.bin/mg/dired.c ==
> Go look the line 729:
>
> if ((fopen(dname,"r")) == NULL) {
> ...
>
> Now you can cry
>

 What is your point ?

>>>
>>> you leak a FILE object and a descriptor.
>>
>> Aww jesus, completely missed it !
>
> So that was just to check permission:
>
> ==
> http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/mg/dired.c.diff?r1=1.45;r2=1.46
>
> From the Loganaden Velvindron:
>  Make dired more sane (and emacslike):
>  *  Position cursor at first filename after ..
>  *  Don't reposition cursor on reopening
>  *  Check for permission before attempting to open directory
>
> I took forever to get this in. Thanks, Logan for being patient!
> ==
>
> That should be an access(2) call.
>

 or stat(2) due to tctu.
>>>
>>> I believe in that case it would be the same, since there is still a
>>> window between stat(2)/access(2) and open(2).
>>
>> I mean, considering he would open/stat/close and open again.
>
> I didn't actually look at the code; I just noticed the words
> permission and access(2) and hit reply :)
>
> Cheers.

Today is definately not my day, forgot that stat takes a path and not an fd.



Re: Goodbye to you my file descriptor

2012-10-30 Thread Okan Demirmen
On Tue, Oct 30, 2012 at 11:53 AM, Christiano F. Haesbaert
 wrote:
> On 30 October 2012 16:52, Christiano F. Haesbaert
>  wrote:
>> On 30 October 2012 16:45, Okan Demirmen  wrote:
>>> On Tue, Oct 30, 2012 at 10:32 AM, Christiano F. Haesbaert
>>>  wrote:
 On 30 October 2012 15:03, Christiano F. Haesbaert
  wrote:
> On 30 October 2012 15:00, Mike Belopuhov  wrote:
>> On Tue, Oct 30, 2012 at 2:58 PM, Christiano F. Haesbaert
>>  wrote:
>>> On 30 October 2012 14:36, rustyBSD  wrote:
 MMmhh...

 == /usr/src/usr.bin/mg/dired.c ==
 Go look the line 729:

 if ((fopen(dname,"r")) == NULL) {
 ...

 Now you can cry

>>>
>>> What is your point ?
>>>
>>
>> you leak a FILE object and a descriptor.
>
> Aww jesus, completely missed it !

 So that was just to check permission:

 ==
 http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/mg/dired.c.diff?r1=1.45;r2=1.46

 From the Loganaden Velvindron:
  Make dired more sane (and emacslike):
  *  Position cursor at first filename after ..
  *  Don't reposition cursor on reopening
  *  Check for permission before attempting to open directory

 I took forever to get this in. Thanks, Logan for being patient!
 ==

 That should be an access(2) call.

>>>
>>> or stat(2) due to tctu.
>>
>> I believe in that case it would be the same, since there is still a
>> window between stat(2)/access(2) and open(2).
>
> I mean, considering he would open/stat/close and open again.

I didn't actually look at the code; I just noticed the words
permission and access(2) and hit reply :)

Cheers.



Re: Goodbye to you my file descriptor

2012-10-30 Thread Christiano F. Haesbaert
On 30 October 2012 16:52, Christiano F. Haesbaert
 wrote:
> On 30 October 2012 16:45, Okan Demirmen  wrote:
>> On Tue, Oct 30, 2012 at 10:32 AM, Christiano F. Haesbaert
>>  wrote:
>>> On 30 October 2012 15:03, Christiano F. Haesbaert
>>>  wrote:
 On 30 October 2012 15:00, Mike Belopuhov  wrote:
> On Tue, Oct 30, 2012 at 2:58 PM, Christiano F. Haesbaert
>  wrote:
>> On 30 October 2012 14:36, rustyBSD  wrote:
>>> MMmhh...
>>>
>>> == /usr/src/usr.bin/mg/dired.c ==
>>> Go look the line 729:
>>>
>>> if ((fopen(dname,"r")) == NULL) {
>>> ...
>>>
>>> Now you can cry
>>>
>>
>> What is your point ?
>>
>
> you leak a FILE object and a descriptor.

 Aww jesus, completely missed it !
>>>
>>> So that was just to check permission:
>>>
>>> ==
>>> http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/mg/dired.c.diff?r1=1.45;r2=1.46
>>>
>>> From the Loganaden Velvindron:
>>>  Make dired more sane (and emacslike):
>>>  *  Position cursor at first filename after ..
>>>  *  Don't reposition cursor on reopening
>>>  *  Check for permission before attempting to open directory
>>>
>>> I took forever to get this in. Thanks, Logan for being patient!
>>> ==
>>>
>>> That should be an access(2) call.
>>>
>>
>> or stat(2) due to tctu.
>
> I believe in that case it would be the same, since there is still a
> window between stat(2)/access(2) and open(2).

I mean, considering he would open/stat/close and open again.



Re: Goodbye to you my file descriptor

2012-10-30 Thread Christiano F. Haesbaert
On 30 October 2012 16:45, Okan Demirmen  wrote:
> On Tue, Oct 30, 2012 at 10:32 AM, Christiano F. Haesbaert
>  wrote:
>> On 30 October 2012 15:03, Christiano F. Haesbaert
>>  wrote:
>>> On 30 October 2012 15:00, Mike Belopuhov  wrote:
 On Tue, Oct 30, 2012 at 2:58 PM, Christiano F. Haesbaert
  wrote:
> On 30 October 2012 14:36, rustyBSD  wrote:
>> MMmhh...
>>
>> == /usr/src/usr.bin/mg/dired.c ==
>> Go look the line 729:
>>
>> if ((fopen(dname,"r")) == NULL) {
>> ...
>>
>> Now you can cry
>>
>
> What is your point ?
>

 you leak a FILE object and a descriptor.
>>>
>>> Aww jesus, completely missed it !
>>
>> So that was just to check permission:
>>
>> ==
>> http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/mg/dired.c.diff?r1=1.45;r2=1.46
>>
>> From the Loganaden Velvindron:
>>  Make dired more sane (and emacslike):
>>  *  Position cursor at first filename after ..
>>  *  Don't reposition cursor on reopening
>>  *  Check for permission before attempting to open directory
>>
>> I took forever to get this in. Thanks, Logan for being patient!
>> ==
>>
>> That should be an access(2) call.
>>
>
> or stat(2) due to tctu.

I believe in that case it would be the same, since there is still a
window between stat(2)/access(2) and open(2).



Re: Goodbye to you my file descriptor

2012-10-30 Thread Okan Demirmen
On Tue, Oct 30, 2012 at 10:32 AM, Christiano F. Haesbaert
 wrote:
> On 30 October 2012 15:03, Christiano F. Haesbaert
>  wrote:
>> On 30 October 2012 15:00, Mike Belopuhov  wrote:
>>> On Tue, Oct 30, 2012 at 2:58 PM, Christiano F. Haesbaert
>>>  wrote:
 On 30 October 2012 14:36, rustyBSD  wrote:
> MMmhh...
>
> == /usr/src/usr.bin/mg/dired.c ==
> Go look the line 729:
>
> if ((fopen(dname,"r")) == NULL) {
> ...
>
> Now you can cry
>

 What is your point ?

>>>
>>> you leak a FILE object and a descriptor.
>>
>> Aww jesus, completely missed it !
>
> So that was just to check permission:
>
> ==
> http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/mg/dired.c.diff?r1=1.45;r2=1.46
>
> From the Loganaden Velvindron:
>  Make dired more sane (and emacslike):
>  *  Position cursor at first filename after ..
>  *  Don't reposition cursor on reopening
>  *  Check for permission before attempting to open directory
>
> I took forever to get this in. Thanks, Logan for being patient!
> ==
>
> That should be an access(2) call.
>

or stat(2) due to tctu.



Re: cwm reload support

2012-10-30 Thread Okan Demirmen
On Tue 2012.10.30 at 18:27 +0400, Alexander Polakov wrote:
> * Alexander Polakov  [121030 14:40]:
> > * Okan Demirmen  [121030 04:10]:
> > > will anyone miss reload support?  one can always re-exec cwm, or any
> > > other wm for a matter of fact.
> > 
> > I don't know the keybinding for it. It's useless :-)
> 
> It seems people do really use that. How about this diff?
> In short: do u_exec("cwm") in conf_reload(). This should probably be
> u_exec(somewhere-argv0-is-saved).

or use __progname ; also rename from 'reload' to 'restart'

to answer other questions: yes, reload config support requires a lot
more scafolding to do it right, and we don't have it - so it's mostly a
hack today and just kinda works ok.  the current reload hack gets in the
way of other things that seem to be more valuable; reload can come back,
but only in a complete formso get rid of what we have to encourage
that, if anyone really cares that much :)

Index: calmwm.h
===
RCS file: /home/open/cvs/xenocara/app/cwm/calmwm.h,v
retrieving revision 1.153
diff -u -p -r1.153 calmwm.h
--- calmwm.h9 Sep 2012 19:47:47 -   1.153
+++ calmwm.h30 Oct 2012 14:56:24 -
@@ -397,7 +397,7 @@ void kbfunc_lock(struct client_ctx 
*,
 voidkbfunc_menu_search(struct client_ctx *, union arg *);
 voidkbfunc_moveresize(struct client_ctx *, union arg *);
 voidkbfunc_quit_wm(struct client_ctx *, union arg *);
-voidkbfunc_reload(struct client_ctx *, union arg *);
+voidkbfunc_restart(struct client_ctx *, union arg *);
 voidkbfunc_ssh(struct client_ctx *, union arg *);
 voidkbfunc_term(struct client_ctx *, union arg *);
 
@@ -431,7 +431,6 @@ void conf_grab(struct conf *, 
struct 
 voidconf_grab_mouse(struct client_ctx *);
 voidconf_init(struct conf *);
 voidconf_mousebind(struct conf *, char *, char *);
-voidconf_reload(struct conf *);
 voidconf_setup(struct conf *, const char *);
 voidconf_ungrab(struct conf *, struct keybinding *);
 
@@ -449,7 +448,6 @@ void xev_loop(void);
 voidxu_btn_grab(Window, int, u_int);
 voidxu_btn_ungrab(Window, int, u_int);
 voidxu_configure(struct client_ctx *);
-voidxu_freecolor(struct screen_ctx *, unsigned long);
 voidxu_getatoms(void);
 unsigned long   xu_getcolor(struct screen_ctx *, char *);
 int xu_getprop(Window, Atom, Atom, long, u_char **);
Index: conf.c
===
RCS file: /home/open/cvs/xenocara/app/cwm/conf.c,v
retrieving revision 1.100
diff -u -p -r1.100 conf.c
--- conf.c  29 Oct 2012 19:46:03 -  1.100
+++ conf.c  30 Oct 2012 14:56:24 -
@@ -81,36 +81,8 @@ conf_color(struct conf *c, struct screen
 {
int  i;
 
-   for (i = 0; i < CWM_COLOR_MAX; i++) {
-   xu_freecolor(sc, sc->color[i].pixel);
+   for (i = 0; i < CWM_COLOR_MAX; i++)
sc->color[i].pixel = xu_getcolor(sc, c->color[i].name);
-   }
-}
-
-void
-conf_reload(struct conf *c)
-{
-   struct screen_ctx   *sc;
-   struct client_ctx   *cc;
-
-   if (parse_config(c->conf_path, c) == -1) {
-   warnx("config file %s has errors, not reloading", c->conf_path);
-   return;
-   }
-
-   TAILQ_FOREACH(sc, &Screenq, entry) {
-   conf_gap(c, sc);
-   conf_color(c, sc);
-   conf_font(c, sc);
-   menu_init(sc);
-   }
-   TAILQ_FOREACH(cc, &Clientq, entry) {
-   conf_client(cc);
-   /* XXX Does not take hmax/vmax into account. */
-   if ((cc->flags & CLIENT_MAXFLAGS) == CLIENT_MAXIMIZED)
-   cc->bwidth = 0;
-   client_draw_border(cc);
-   }
 }
 
 static struct {
@@ -148,7 +120,7 @@ static struct {
{ "CM-equal",   "vmaximize" },
{ "CMS-equal",  "hmaximize" },
{ "CMS-f",  "freeze" },
-   { "CMS-r",  "reload" },
+   { "CMS-r",  "restart" },
{ "CMS-q",  "quit" },
{ "M-h","moveleft" },
{ "M-j","movedown" },
@@ -375,7 +347,7 @@ static struct {
{ "vmaximize", kbfunc_client_vmaximize, KBFLAG_NEEDCLIENT, {0} },
{ "hmaximize", kbfunc_client_hmaximize, KBFLAG_NEEDCLIENT, {0} },
{ "freeze", kbfunc_client_freeze, KBFLAG_NEEDCLIENT, {0} },
-   { "reload", kbfunc_reload, 0, {0} },
+   { "restart", kbfunc_restart, 0, {0} },
{ "quit", kbfunc_quit_wm, 0, {0} },
{ "exec", kbfunc_exec, 0, {.i = CWM_EXEC_PROGRAM} },
{ "exec_wm",

Re: Goodbye to you my file descriptor

2012-10-30 Thread Christiano F. Haesbaert
On 30 October 2012 15:03, Christiano F. Haesbaert
 wrote:
> On 30 October 2012 15:00, Mike Belopuhov  wrote:
>> On Tue, Oct 30, 2012 at 2:58 PM, Christiano F. Haesbaert
>>  wrote:
>>> On 30 October 2012 14:36, rustyBSD  wrote:
 MMmhh...

 == /usr/src/usr.bin/mg/dired.c ==
 Go look the line 729:

 if ((fopen(dname,"r")) == NULL) {
 ...

 Now you can cry

>>>
>>> What is your point ?
>>>
>>
>> you leak a FILE object and a descriptor.
>
> Aww jesus, completely missed it !

So that was just to check permission:

==
http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/mg/dired.c.diff?r1=1.45;r2=1.46

>From the Loganaden Velvindron:
 Make dired more sane (and emacslike):
 *  Position cursor at first filename after ..
 *  Don't reposition cursor on reopening
 *  Check for permission before attempting to open directory

I took forever to get this in. Thanks, Logan for being patient!
==

That should be an access(2) call.



Re: cwm reload support

2012-10-30 Thread Alexander Polakov
* Alexander Polakov  [121030 14:40]:
> * Okan Demirmen  [121030 04:10]:
> > will anyone miss reload support?  one can always re-exec cwm, or any
> > other wm for a matter of fact.
> 
> I don't know the keybinding for it. It's useless :-)

It seems people do really use that. How about this diff?
In short: do u_exec("cwm") in conf_reload(). This should probably be
u_exec(somewhere-argv0-is-saved).

Index: calmwm.h
===
RCS file: /cvs/xenocara/app/cwm/calmwm.h,v
retrieving revision 1.153
diff -u -p -u -r1.153 calmwm.h
--- calmwm.h9 Sep 2012 19:47:47 -   1.153
+++ calmwm.h30 Oct 2012 14:24:13 -
@@ -397,7 +397,7 @@ void kbfunc_lock(struct client_ctx 
*,
 voidkbfunc_menu_search(struct client_ctx *, union arg *);
 voidkbfunc_moveresize(struct client_ctx *, union arg *);
 voidkbfunc_quit_wm(struct client_ctx *, union arg *);
-voidkbfunc_reload(struct client_ctx *, union arg *);
+voidkbfunc_reload(struct client_ctx *, union arg *);
 voidkbfunc_ssh(struct client_ctx *, union arg *);
 voidkbfunc_term(struct client_ctx *, union arg *);
 
@@ -431,7 +431,6 @@ void conf_grab(struct conf *, 
struct 
 voidconf_grab_mouse(struct client_ctx *);
 voidconf_init(struct conf *);
 voidconf_mousebind(struct conf *, char *, char *);
-voidconf_reload(struct conf *);
 voidconf_setup(struct conf *, const char *);
 voidconf_ungrab(struct conf *, struct keybinding *);
 
@@ -449,7 +448,6 @@ void xev_loop(void);
 voidxu_btn_grab(Window, int, u_int);
 voidxu_btn_ungrab(Window, int, u_int);
 voidxu_configure(struct client_ctx *);
-voidxu_freecolor(struct screen_ctx *, unsigned long);
 voidxu_getatoms(void);
 unsigned long   xu_getcolor(struct screen_ctx *, char *);
 int xu_getprop(Window, Atom, Atom, long, u_char **);
Index: conf.c
===
RCS file: /cvs/xenocara/app/cwm/conf.c,v
retrieving revision 1.100
diff -u -p -u -r1.100 conf.c
--- conf.c  29 Oct 2012 19:46:03 -  1.100
+++ conf.c  30 Oct 2012 14:24:13 -
@@ -81,36 +81,8 @@ conf_color(struct conf *c, struct screen
 {
int  i;
 
-   for (i = 0; i < CWM_COLOR_MAX; i++) {
-   xu_freecolor(sc, sc->color[i].pixel);
+   for (i = 0; i < CWM_COLOR_MAX; i++)
sc->color[i].pixel = xu_getcolor(sc, c->color[i].name);
-   }
-}
-
-void
-conf_reload(struct conf *c)
-{
-   struct screen_ctx   *sc;
-   struct client_ctx   *cc;
-
-   if (parse_config(c->conf_path, c) == -1) {
-   warnx("config file %s has errors, not reloading", c->conf_path);
-   return;
-   }
-
-   TAILQ_FOREACH(sc, &Screenq, entry) {
-   conf_gap(c, sc);
-   conf_color(c, sc);
-   conf_font(c, sc);
-   menu_init(sc);
-   }
-   TAILQ_FOREACH(cc, &Clientq, entry) {
-   conf_client(cc);
-   /* XXX Does not take hmax/vmax into account. */
-   if ((cc->flags & CLIENT_MAXFLAGS) == CLIENT_MAXIMIZED)
-   cc->bwidth = 0;
-   client_draw_border(cc);
-   }
 }
 
 static struct {
@@ -148,7 +120,7 @@ static struct {
{ "CM-equal",   "vmaximize" },
{ "CMS-equal",  "hmaximize" },
{ "CMS-f",  "freeze" },
-   { "CMS-r",  "reload" },
+   { "CMS-r",  "reload" },
{ "CMS-q",  "quit" },
{ "M-h","moveleft" },
{ "M-j","movedown" },
Index: cwm.1
===
RCS file: /cvs/xenocara/app/cwm/cwm.1,v
retrieving revision 1.47
diff -u -p -u -r1.47 cwm.1
--- cwm.1   9 May 2012 18:37:39 -   1.47
+++ cwm.1   30 Oct 2012 14:24:13 -
@@ -115,8 +115,6 @@ Spawn
 dialog; allows you to switch from
 .Nm
 to another window manager without restarting the X server.
-.It Ic CMS-r
-Reload configuration.
 .It Ic CMS-q
 Quit
 .Nm .
Index: cwmrc.5
===
RCS file: /cvs/xenocara/app/cwm/cwmrc.5,v
retrieving revision 1.44
diff -u -p -u -r1.44 cwmrc.5
--- cwmrc.5 28 Oct 2012 20:13:02 -  1.44
+++ cwmrc.5 30 Oct 2012 14:24:13 -
@@ -269,8 +269,6 @@ mousebind M-3   window_resize
 .Ed
 .Sh BIND COMMAND LIST
 .Bl -tag -width 18n -compact
-.It reload
-Reload configuration.
 .It quit
 Quit
 .Xr cwm 1 .
Index: font.c
===
RCS file: /cvs/xenocara/app/cwm/f

Re: Goodbye to you my file descriptor

2012-10-30 Thread Christiano F. Haesbaert
On 30 October 2012 15:00, Mike Belopuhov  wrote:
> On Tue, Oct 30, 2012 at 2:58 PM, Christiano F. Haesbaert
>  wrote:
>> On 30 October 2012 14:36, rustyBSD  wrote:
>>> MMmhh...
>>>
>>> == /usr/src/usr.bin/mg/dired.c ==
>>> Go look the line 729:
>>>
>>> if ((fopen(dname,"r")) == NULL) {
>>> ...
>>>
>>> Now you can cry
>>>
>>
>> What is your point ?
>>
>
> you leak a FILE object and a descriptor.

Aww jesus, completely missed it !



Re: Goodbye to you my file descriptor

2012-10-30 Thread Mike Belopuhov
On Tue, Oct 30, 2012 at 2:58 PM, Christiano F. Haesbaert
 wrote:
> On 30 October 2012 14:36, rustyBSD  wrote:
>> MMmhh...
>>
>> == /usr/src/usr.bin/mg/dired.c ==
>> Go look the line 729:
>>
>> if ((fopen(dname,"r")) == NULL) {
>> ...
>>
>> Now you can cry
>>
>
> What is your point ?
>

you leak a FILE object and a descriptor.



Re: Goodbye to you my file descriptor

2012-10-30 Thread Christiano F. Haesbaert
On 30 October 2012 14:58, Christiano F. Haesbaert
 wrote:
> On 30 October 2012 14:36, rustyBSD  wrote:
>> MMmhh...
>>
>> == /usr/src/usr.bin/mg/dired.c ==
>> Go look the line 729:
>>
>> if ((fopen(dname,"r")) == NULL) {
>> ...
>>
>> Now you can cry
>>
>
> What is your point ?

Hmm just noticed there are some calls that do not check the NULL case,
looks like you have a diff to write :).



Re: Goodbye to you my file descriptor

2012-10-30 Thread Christiano F. Haesbaert
On 30 October 2012 14:36, rustyBSD  wrote:
> MMmhh...
>
> == /usr/src/usr.bin/mg/dired.c ==
> Go look the line 729:
>
> if ((fopen(dname,"r")) == NULL) {
> ...
>
> Now you can cry
>

What is your point ?



Goodbye to you my file descriptor

2012-10-30 Thread rustyBSD
MMmhh...

== /usr/src/usr.bin/mg/dired.c ==
Go look the line 729:

if ((fopen(dname,"r")) == NULL) {
...

Now you can cry



Re: cwm reload support

2012-10-30 Thread Stuart Henderson
On 2012/10/29 19:32, Okan Demirmen wrote:
> will anyone miss reload support?  one can always re-exec cwm, or any
> other wm for a matter of fact.

yes - I use this when I've updated the config file - re-exec would be
ok because the window groups etc are memorized between instances,
but I'd quite like to have a one-hit way of doing this which can be
bound to ctrl+shift+alt+R, rather than having to go through the menu
to choose a WM.

(actually the only time I use CWM_EXEC_WM is when I'm restarting cwm,
and when I do that I've usually already tried ctrl+shift+alt+R to restart
and then have to look up what the key combination for EXEC_WM is ;)



Re: cwm reload support

2012-10-30 Thread Alexander Polakov
* Okan Demirmen  [121030 04:10]:
> will anyone miss reload support?  one can always re-exec cwm, or any
> other wm for a matter of fact.

I don't know the keybinding for it. It's useless :-)

-- 
Alexander Polakov | plhk.ru



Re: cwm reload support

2012-10-30 Thread Thomas Pfaff
On Mon, 29 Oct 2012 19:32:16 -0400
Okan Demirmen  wrote:

> will anyone miss reload support?  one can always re-exec cwm, or any
> other wm for a matter of fact.

I use this function once in a while but sure, I can always restart cwm.
You remove a bit of code here which is more important to me than to
be able to reload the configuration.

> Index: calmwm.h
> ===
> RCS file: /home/open/cvs/xenocara/app/cwm/calmwm.h,v
> retrieving revision 1.153
> diff -u -p -r1.153 calmwm.h
> --- calmwm.h  9 Sep 2012 19:47:47 -   1.153
> +++ calmwm.h  29 Oct 2012 23:31:45 -
> @@ -397,7 +397,6 @@ void   kbfunc_lock(struct client_ctx 
> *,
>  void  kbfunc_menu_search(struct client_ctx *, union arg *);
>  void  kbfunc_moveresize(struct client_ctx *, union arg *);
>  void  kbfunc_quit_wm(struct client_ctx *, union arg *);
> -void  kbfunc_reload(struct client_ctx *, union arg *);
>  void  kbfunc_ssh(struct client_ctx *, union arg *);
>  void  kbfunc_term(struct client_ctx *, union arg *);
[...]



Re: [PATCH] group.c: group_autogroup looks for best match

2012-10-30 Thread Kent R. Spillner
Hey, dude-

> > Below is a new diff which only sets no if class matches and name is NULL or
> > if class and name both match.
> > 
> > Since we must explicitly check for name == NULL I decided to also go ahead
> > and skip setting no if any previous class-only matches were found.
> 
> It's too bad the explicit class+name match is backwards in the config
> grammar;  I suppose we could reverse it and may make more sense going
> generic to specific matches...but that's another topic.

Hrmmm...  Well, it's not backwards compared to the way xprop(1) displays
WM_CLASS (see my latest diff in the other thread ;-)).  But I agree with
you that going from generic to specific makes a lot of sense.

How about this (while here also fix the grammar so quotes are optional around
the "name,class" syntax unless either value contains a space)?


Index: calmwm.h
===
RCS file: /cvs/xenocara/app/cwm/calmwm.h,v
retrieving revision 1.153
diff -p -u -r1.153 calmwm.h
--- calmwm.h9 Sep 2012 19:47:47 -   1.153
+++ calmwm.h30 Oct 2012 05:57:08 -
@@ -343,7 +343,7 @@ void group_client_delete(struct 
clien
 voidgroup_cycle(struct screen_ctx *, int);
 voidgroup_hidetoggle(struct screen_ctx *, int);
 voidgroup_init(struct screen_ctx *);
-voidgroup_make_autogroup(struct conf *, char *, int);
+voidgroup_make_autogroup(struct conf *, int, char *, char 
*);
 voidgroup_menu(XButtonEvent *);
 voidgroup_movetogroup(struct client_ctx *, int);
 voidgroup_only(struct screen_ctx *, int);
Index: cwmrc.5
===
RCS file: /cvs/xenocara/app/cwm/cwmrc.5,v
retrieving revision 1.44
diff -p -u -r1.44 cwmrc.5
--- cwmrc.5 28 Oct 2012 20:13:02 -  1.44
+++ cwmrc.5 30 Oct 2012 05:57:08 -
@@ -40,6 +40,7 @@ The following options are accepted:
 .Pp
 .Bl -tag -width Ds -compact
 .It Ic autogroup Ar group windowclass
+.It Ic autogroup Ar group windowclass windowname
 .It Ic autogroup Ar group windowname,windowclass
 Automatically add new windows to
 .Ar group
Index: group.c
===
RCS file: /cvs/xenocara/app/cwm/group.c,v
retrieving revision 1.60
diff -p -u -r1.60 group.c
--- group.c 9 Sep 2012 20:52:57 -   1.60
+++ group.c 30 Oct 2012 05:57:08 -
@@ -164,19 +164,34 @@ group_init(struct screen_ctx *sc)
 }
 
 void
-group_make_autogroup(struct conf *conf, char *val, int no)
+group_make_autogroup(struct conf *conf, int no, char *class, char *name)
 {
struct autogroupwin *aw;
-   char*p;
+   char*p, *tmp;
 
aw = xcalloc(1, sizeof(*aw));
 
-   if ((p = strchr(val, ',')) == NULL) {
-   aw->name = NULL;
-   aw->class = xstrdup(val);
+   if ((p = strchr(class, ',')) == NULL) {
+   if (name == NULL)
+   aw->name = NULL;
+   else
+   aw->name = xstrdup(name);
+
+   aw->class = xstrdup(class);
} else {
+   /*
+* Avoid the awkwardness of aw->name = xstrdup(class)
+* below.
+*/
+   tmp = class;
+
*(p++) = '\0';
-   aw->name = xstrdup(val);
+
+   if (name == NULL)
+   aw->name = xstrdup(tmp);
+   else
+   aw->name = xstrdup(name);
+
aw->class = xstrdup(p);
}
aw->num = no;
Index: parse.y
===
RCS file: /cvs/xenocara/app/cwm/parse.y,v
retrieving revision 1.33
diff -p -u -r1.33 parse.y
--- parse.y 8 Sep 2011 12:35:33 -   1.33
+++ parse.y 30 Oct 2012 05:57:08 -
@@ -129,15 +129,45 @@ main  : FONTNAME STRING   {
free($2);
free($3);
}
-   | AUTOGROUP NUMBER STRING   {
+   | AUTOGROUP NUMBER STRING   {
if ($2 < 0 || $2 > 9) {
free($3);
yyerror("autogroup number out of range: %d", 
$2);
YYERROR;
}
 
-   group_make_autogroup(conf, $3, $2);
+   group_make_autogroup(conf, $2, $3, NULL);
free($3);
+   }
+   | AUTOGROUP NUMBER STRING STRING{
+   char*p;
+
+   if ($2 < 0 || $2 > 9) {
+   free($3);
+   yyerror("autogroup number out of range: %d", 
$2);
+  

Re: cwm reload support

2012-10-30 Thread Kent R. Spillner
Hey, dude-

> will anyone miss reload support?  one can always re-exec cwm, or any
> other wm for a matter of fact.

I use it every once in a while, but I won't miss it.  Out of curiousity,
though, what's the motivation?  Too many hacks for handling config
changes that should be visible on the screen?

Anyways, I'm running with your diff now and haven't encountered any
regressions.

Thanks again!

Best,
Kent



Re: cwm reload support

2012-10-30 Thread Antoine Jacoutot
On Mon, Oct 29, 2012 at 07:32:16PM -0400, Okan Demirmen wrote:
> will anyone miss reload support?  one can always re-exec cwm, or any
> other wm for a matter of fact.

I use it often, but if there is another way to achieve the same thing, I won't 
cry over it.


> 
> Index: calmwm.h
> ===
> RCS file: /home/open/cvs/xenocara/app/cwm/calmwm.h,v
> retrieving revision 1.153
> diff -u -p -r1.153 calmwm.h
> --- calmwm.h  9 Sep 2012 19:47:47 -   1.153
> +++ calmwm.h  29 Oct 2012 23:31:45 -
> @@ -397,7 +397,6 @@ void   kbfunc_lock(struct client_ctx 
> *,
>  void  kbfunc_menu_search(struct client_ctx *, union arg *);
>  void  kbfunc_moveresize(struct client_ctx *, union arg *);
>  void  kbfunc_quit_wm(struct client_ctx *, union arg *);
> -void  kbfunc_reload(struct client_ctx *, union arg *);
>  void  kbfunc_ssh(struct client_ctx *, union arg *);
>  void  kbfunc_term(struct client_ctx *, union arg *);
>  
> @@ -431,7 +430,6 @@ void   conf_grab(struct conf *, 
> struct 
>  void  conf_grab_mouse(struct client_ctx *);
>  void  conf_init(struct conf *);
>  void  conf_mousebind(struct conf *, char *, char *);
> -void  conf_reload(struct conf *);
>  void  conf_setup(struct conf *, const char *);
>  void  conf_ungrab(struct conf *, struct keybinding *);
>  
> @@ -449,7 +447,6 @@ void   xev_loop(void);
>  void  xu_btn_grab(Window, int, u_int);
>  void  xu_btn_ungrab(Window, int, u_int);
>  void  xu_configure(struct client_ctx *);
> -void  xu_freecolor(struct screen_ctx *, unsigned long);
>  void  xu_getatoms(void);
>  unsigned long xu_getcolor(struct screen_ctx *, char *);
>  int   xu_getprop(Window, Atom, Atom, long, u_char **);
> Index: conf.c
> ===
> RCS file: /home/open/cvs/xenocara/app/cwm/conf.c,v
> retrieving revision 1.100
> diff -u -p -r1.100 conf.c
> --- conf.c29 Oct 2012 19:46:03 -  1.100
> +++ conf.c29 Oct 2012 23:31:45 -
> @@ -81,36 +81,8 @@ conf_color(struct conf *c, struct screen
>  {
>   int  i;
>  
> - for (i = 0; i < CWM_COLOR_MAX; i++) {
> - xu_freecolor(sc, sc->color[i].pixel);
> + for (i = 0; i < CWM_COLOR_MAX; i++)
>   sc->color[i].pixel = xu_getcolor(sc, c->color[i].name);
> - }
> -}
> -
> -void
> -conf_reload(struct conf *c)
> -{
> - struct screen_ctx   *sc;
> - struct client_ctx   *cc;
> -
> - if (parse_config(c->conf_path, c) == -1) {
> - warnx("config file %s has errors, not reloading", c->conf_path);
> - return;
> - }
> -
> - TAILQ_FOREACH(sc, &Screenq, entry) {
> - conf_gap(c, sc);
> - conf_color(c, sc);
> - conf_font(c, sc);
> - menu_init(sc);
> - }
> - TAILQ_FOREACH(cc, &Clientq, entry) {
> - conf_client(cc);
> - /* XXX Does not take hmax/vmax into account. */
> - if ((cc->flags & CLIENT_MAXFLAGS) == CLIENT_MAXIMIZED)
> - cc->bwidth = 0;
> - client_draw_border(cc);
> - }
>  }
>  
>  static struct {
> @@ -148,7 +120,6 @@ static struct {
>   { "CM-equal",   "vmaximize" },
>   { "CMS-equal",  "hmaximize" },
>   { "CMS-f",  "freeze" },
> - { "CMS-r",  "reload" },
>   { "CMS-q",  "quit" },
>   { "M-h","moveleft" },
>   { "M-j","movedown" },
> @@ -375,7 +346,6 @@ static struct {
>   { "vmaximize", kbfunc_client_vmaximize, KBFLAG_NEEDCLIENT, {0} },
>   { "hmaximize", kbfunc_client_hmaximize, KBFLAG_NEEDCLIENT, {0} },
>   { "freeze", kbfunc_client_freeze, KBFLAG_NEEDCLIENT, {0} },
> - { "reload", kbfunc_reload, 0, {0} },
>   { "quit", kbfunc_quit_wm, 0, {0} },
>   { "exec", kbfunc_exec, 0, {.i = CWM_EXEC_PROGRAM} },
>   { "exec_wm", kbfunc_exec, 0, {.i = CWM_EXEC_WM} },
> Index: cwm.1
> ===
> RCS file: /home/open/cvs/xenocara/app/cwm/cwm.1,v
> retrieving revision 1.47
> diff -u -p -r1.47 cwm.1
> --- cwm.1 9 May 2012 18:37:39 -   1.47
> +++ cwm.1 29 Oct 2012 23:31:45 -
> @@ -115,8 +115,6 @@ Spawn
>  dialog; allows you to switch from
>  .Nm
>  to another window manager without restarting the X server.
> -.It Ic CMS-r
> -Reload configuration.
>  .It Ic CMS-q
>  Quit
>  .Nm .
> Index: cwmrc.5
> ===
> RCS file: /home/open/cvs/xenocara/app/cwm/cwmrc.5,v
> retrieving revision 1.44
> diff -u -p -r1.44 cwmrc.5
> --- cwmrc.5   28 Oct 2012 20:13:02 -