libssl/src/apps don't cast {m,re}alloc

2014-04-23 Thread Thomas Pfaff
Don't cast {m,re}alloc.  No point and it's inconsistent already.

Index: apps.c
===
RCS file: /cvs/src/lib/libssl/src/apps/apps.c,v
retrieving revision 1.42
diff -u -p -r1.42 apps.c
--- apps.c  22 Apr 2014 14:54:13 -  1.42
+++ apps.c  23 Apr 2014 07:20:29 -
@@ -216,7 +216,7 @@ chopup_args(ARGS * arg, char *buf, int *
i = 0;
if (arg-count == 0) {
arg-count = 20;
-   arg-data = (char **)malloc(sizeof(char *) * arg-count);
+   arg-data = malloc(sizeof(char *) * arg-count);
}
for (i = 0; i  arg-count; i++)
arg-data[i] = NULL;
@@ -236,8 +236,7 @@ chopup_args(ARGS * arg, char *buf, int *
if (num = arg-count) {
char **tmp_p;
int tlen = arg-count + 20;
-   tmp_p = (char **) realloc(arg-data,
-   sizeof(char *) * tlen);
+   tmp_p = realloc(arg-data, sizeof(char *) * tlen);
if (tmp_p == NULL)
return 0;
arg-data = tmp_p;
@@ -417,7 +416,7 @@ password_callback(char *buf, int bufsiz,
ok = UI_add_input_string(ui, prompt, ui_flags, buf,
PW_MIN_LENGTH, bufsiz - 1);
if (ok = 0  verify) {
-   buff = (char *) malloc(bufsiz);
+   buff = malloc(bufsiz);
ok = UI_add_verify_string(ui, prompt, ui_flags, buff,
PW_MIN_LENGTH, bufsiz - 1, buf);
}
Index: ca.c
===
RCS file: /cvs/src/lib/libssl/src/apps/ca.c,v
retrieving revision 1.46
diff -u -p -r1.46 ca.c
--- ca.c22 Apr 2014 13:32:17 -  1.46
+++ ca.c23 Apr 2014 07:20:29 -
@@ -1981,17 +1981,17 @@ again2:
goto err;
 
/* We now just add it to the database */
-   row[DB_type] = (char *) malloc(2);
+   row[DB_type] = malloc(2);
 
tm = X509_get_notAfter(ret);
-   row[DB_exp_date] = (char *) malloc(tm-length + 1);
+   row[DB_exp_date] = malloc(tm-length + 1);
memcpy(row[DB_exp_date], tm-data, tm-length);
row[DB_exp_date][tm-length] = '\0';
 
row[DB_rev_date] = NULL;
 
/* row[DB_serial] done already */
-   row[DB_file] = (char *) malloc(8);
+   row[DB_file] = malloc(8);
row[DB_name] = X509_NAME_oneline(X509_get_subject_name(ret), NULL, 0);
 
if ((row[DB_type] == NULL) || (row[DB_exp_date] == NULL) ||
@@ -2003,8 +2003,7 @@ again2:
row[DB_type][0] = 'V';
row[DB_type][1] = '\0';
 
-   if ((irow = (char **)malloc(sizeof(char *) * (DB_NUMBER + 1))) ==
-   NULL) {
+   if ((irow = malloc(sizeof(char *) * (DB_NUMBER + 1))) == NULL) {
BIO_printf(bio_err, Memory allocation failure\n);
goto err;
}
@@ -2245,17 +2244,17 @@ do_revoke(X509 * x509, CA_DB * db, int t
row[DB_serial], row[DB_name]);
 
/* We now just add it to the database */
-   row[DB_type] = (char *) malloc(2);
+   row[DB_type] = malloc(2);
 
tm = X509_get_notAfter(x509);
-   row[DB_exp_date] = (char *) malloc(tm-length + 1);
+   row[DB_exp_date] = malloc(tm-length + 1);
memcpy(row[DB_exp_date], tm-data, tm-length);
row[DB_exp_date][tm-length] = '\0';
 
row[DB_rev_date] = NULL;
 
/* row[DB_serial] done already */
-   row[DB_file] = (char *) malloc(8);
+   row[DB_file] = malloc(8);
 
/* row[DB_name] done already */
 
@@ -2268,7 +2267,7 @@ do_revoke(X509 * x509, CA_DB * db, int t
row[DB_type][0] = 'V';
row[DB_type][1] = '\0';
 
-   if ((irow = (char **)malloc(sizeof(char *) *
+   if ((irow = malloc(sizeof(char *) *
(DB_NUMBER + 1))) == NULL) {
BIO_printf(bio_err, Memory allocation failure\n);
goto err;
@@ -2405,7 +2404,7 @@ do_updatedb(CA_DB * db)
 
/* get actual time and make a string */
a_tm = X509_gmtime_adj(a_tm, 0);
-   a_tm_s = (char *) malloc(a_tm-length + 1);
+   a_tm_s = malloc(a_tm-length + 1);
if (a_tm_s == NULL) {
cnt = -1;
goto err;
Index: dgst.c
===
RCS file: /cvs/src/lib/libssl/src/apps/dgst.c,v
retrieving revision 1.27
diff -u -p -r1.27 dgst.c
--- dgst.c  18 Apr 2014 19:54:57 -  1.27
+++ dgst.c  23 Apr 2014 07:20:30 -
@@ -132,7 +132,7 @@ dgst_main(int argc, char **argv)
 
apps_startup();
 
-   if ((buf = (unsigned char *) malloc(BUFSIZE)) == 

Re: libssl/src/apps don't cast {m,re}alloc

2014-04-24 Thread Thomas Pfaff
 This doesn't fix the problems, only removes markers alerting us
 to audit it.
 
 Memory management in these files is still missing integer overflow
 checks, NULL return checks, and is full of crazy abominations [...]

Yes, I saw that but I thought I'd take care of one thing first
then send patches to fix other things, but I get your point.

 X509_NAME *
 parse_name(char *subject, long chtype, int multirdn)
 {
   size_t buflen = strlen(subject) + 1;/* ...
   char *buf = malloc(buflen);
   size_t max_ne = buflen / 2 + 1; /* maximum number of name elements */
   char **ne_types = malloc(max_ne * sizeof(char *));
   char **ne_values = malloc(max_ne * sizeof(char *));
   int *mval = malloc(max_ne * sizeof(int));

Beautiful.



Add EMC Barcode Scanner to usbdevs

2013-12-16 Thread Thomas Pfaff
Add IDs for Elan Microelectronics barcode scanner (from usb.ids).

uhidev1 at uhub3 port 4 configuration 1 interface 0 vendor 0x04f3 product 
0x0001 rev 1.10/1.00 addr 3

uhidev1 at uhub3 port 4 configuration 1 interface 0 Elan Microelectronics 
Corp. Barcode Scanner rev 1.10/1.00 addr 3

Index: usbdevs
===
RCS file: /cvs/src/sys/dev/usb/usbdevs,v
retrieving revision 1.617
diff -u -p -r1.617 usbdevs
--- usbdevs 13 Dec 2013 17:38:38 -  1.617
+++ usbdevs 16 Dec 2013 10:30:55 -
@@ -148,6 +148,7 @@ vendor SAMSUNG2 0x04e8  Samsung Electron
 vendor ANNABOOKS   0x04ed  Annabooks
 vendor JVC 0x04f1  JVC
 vendor CHICONY 0x04f2  Chicony Electronics
+vendor ELAN0x04f3  Elan Microelectronics Corp.
 vendor BROTHER 0x04f9  Brother Industries
 vendor DALLAS  0x04fa  Dallas Semiconductor
 vendor ACER0x0502  Acer
@@ -1569,6 +1570,9 @@ product EICON DIVA852 0x4905  Diva 852 I
 /* EIZO products */
 product EIZO HUB   0x  hub
 product EIZO MONITOR   0x0001  monitor
+
+/* Elan Microelectronics products */
+product ELAN BARCODE   0x0001  Barcode Scanner
 
 /* ELCON Systemtechnik products */
 product ELCON PLAN 0x0002  Goldpfeil P-LAN



cwm: repair cyclegroup and rcyclegroup

2011-05-15 Thread Thomas Pfaff
A tiny oops done by someone cleaning up calmwm.h making cyclegroup and
rcyclegroup behave the same.  The defines below are used as an argument
to group_cycle as a boolean to decide if the groups should be cycled
forward or backward, but now both values are true so it's always done
in reverse.

Index: calmwm.h
===
RCS file: /cvs/xenocara/app/cwm/calmwm.h,v
retrieving revision 1.125
diff -u -p -r1.125 calmwm.h
--- calmwm.h11 May 2011 13:53:51 -  1.125
+++ calmwm.h15 May 2011 16:26:23 -
@@ -72,8 +72,8 @@
 #define CWM_RCYCLE 0x0002
 
 /* group cycle */
-#define CWM_CYCLEGROUP 0x0001
-#define CWM_RCYCLEGROUP0x0002
+#define CWM_CYCLEGROUP 0x
+#define CWM_RCYCLEGROUP0x0001
 
 #define KBTOGROUP(X) ((X) - 1)



ansify fdisk(8) and remove casts in tee(1)

2011-06-23 Thread Thomas Pfaff
fdisk(8)
Index: cmd.c
===
RCS file: /cvs/src/sbin/fdisk/cmd.c,v
retrieving revision 1.45
diff -u -p -r1.45 cmd.c
--- cmd.c   2 Jul 2010 02:54:09 -   1.45
+++ cmd.c   23 Jun 2011 06:50:46 -
@@ -348,12 +348,7 @@ Xwrite(cmd_t *cmd, disk_t *disk, mbr_t *
 
 /* ARGSUSED */
 int
-Xquit(cmd, disk, r, tt, offset)
-   cmd_t *cmd;
-   disk_t *disk;
-   mbr_t *r;
-   mbr_t *tt;
-   int offset;
+Xquit(cmd_t *cmd, disk_t *disk, mbr_t *r, mbr_t *tt, int offset)
 {
 
/* Nothing to do here */


tee(1)
Index: tee.c
===
RCS file: /cvs/src/usr.bin/tee/tee.c,v
retrieving revision 1.7
diff -u -p -r1.7 tee.c
--- tee.c   27 Oct 2009 23:59:44 -  1.7
+++ tee.c   23 Jun 2011 06:44:46 -
@@ -65,7 +65,7 @@ main(int argc, char *argv[])
 
append = 0;
while ((ch = getopt(argc, argv, ai)) != -1)
-   switch((char)ch) {
+   switch(ch) {
case 'a':
append = 1;
break;
@@ -80,7 +80,7 @@ main(int argc, char *argv[])
argv += optind;
argc -= optind;
 
-   if ((buf = malloc((size_t)BSIZE)) == NULL)
+   if ((buf = malloc(BSIZE)) == NULL)
err(1, NULL);
 
add(STDOUT_FILENO, stdout);
@@ -126,7 +126,7 @@ add(int fd, char *name)
 {
LIST *p;
 
-   if ((p = malloc((size_t)sizeof(LIST))) == NULL)
+   if ((p = malloc(sizeof(LIST))) == NULL)
err(1, NULL);
p-fd = fd;
p-name = name;



cwm: uppercase #define

2011-07-07 Thread Thomas Pfaff
Uppercase two #define so we can immediately see they won't change.

Index: kbfunc.c
===
RCS file: /cvs/xenocara/app/cwm/kbfunc.c,v
retrieving revision 1.55
diff -u -p -r1.55 kbfunc.c
--- kbfunc.c24 Jun 2011 06:06:24 -  1.55
+++ kbfunc.c7 Jul 2011 21:09:14 -
@@ -49,8 +49,8 @@ kbfunc_client_raise(struct client_ctx *c
client_raise(cc);
 }
 
-#define typemask   (CWM_MOVE | CWM_RESIZE | CWM_PTRMOVE)
-#define movemask   (CWM_UP | CWM_DOWN | CWM_LEFT | CWM_RIGHT)
+#define TYPEMASK   (CWM_MOVE | CWM_RESIZE | CWM_PTRMOVE)
+#define MOVEMASK   (CWM_UP | CWM_DOWN | CWM_LEFT | CWM_RIGHT)
 void
 kbfunc_moveresize(struct client_ctx *cc, union arg *arg)
 {
@@ -72,7 +72,7 @@ kbfunc_moveresize(struct client_ctx *cc,
amt = amt * 10;
}
 
-   switch (flags  movemask) {
+   switch (flags  MOVEMASK) {
case CWM_UP:
my -= amt;
break;
@@ -86,7 +86,8 @@ kbfunc_moveresize(struct client_ctx *cc,
mx -= amt;
break;
}
-   switch (flags  typemask) {
+   switch (flags  TYPEMASK) {
+
case CWM_MOVE:
cc-geom.y += my;
if (cc-geom.y + cc-geom.height  0)



dd(1) human-readable output

2011-08-23 Thread Thomas Pfaff
This patch makes dd(1) output change from e.g.

$ dd if=/dev/sd0c of=/dev/null bs=512 count=16000
16000+0 records in
16000+0 records out
8192000 bytes transferred in 3.002 secs (2728488 bytes/sec)

to

$ obj/dd if=/dev/sd0c of=/dev/null bs=512 count=16000
16000+0 records in
16000+0 records out
8192000 bytes (7.8MB) transferred in 3.009 seconds (2.6MB/s)

Any interest?

Index: Makefile
===
RCS file: /cvs/src/bin/dd/Makefile,v
retrieving revision 1.5
diff -u -p -r1.5 Makefile
--- Makefile29 May 1998 04:34:20 -  1.5
+++ Makefile23 Aug 2011 18:43:43 -
@@ -2,5 +2,7 @@
 
 PROG=  dd
 SRCS=  args.c conv.c conv_tab.c dd.c misc.c position.c
+DPADD= ${LIBUTIL}
+LDADD= -lutil
 
 .include bsd.prog.mk
Index: misc.c
===
RCS file: /cvs/src/bin/dd/misc.c,v
retrieving revision 1.16
diff -u -p -r1.16 misc.c
--- misc.c  27 Oct 2009 23:59:21 -  1.16
+++ misc.c  23 Aug 2011 18:43:43 -
@@ -45,6 +45,7 @@
 #include errno.h
 #include time.h
 #include unistd.h
+#include util.h
 
 #include dd.h
 #include extern.h
@@ -57,6 +58,7 @@ summary(void)
struct iovec iov[4];
double microsecs;
int i = 0;
+   char sizebuf[FMT_SCALED_STRSIZE], ratebuf[FMT_SCALED_STRSIZE];
 
(void)gettimeofday(nowtv, (struct timezone *)NULL);
timersub(nowtv, st.startv, nowtv);
@@ -85,10 +87,19 @@ summary(void)
iov[i].iov_base = buf[2];
iov[i++].iov_len = strlen(buf[2]);
}
+
+   strlcpy(sizebuf, ?, sizeof sizebuf);
+   fmt_scaled(st.bytes, sizebuf);
+   sizebuf[strcspn(sizebuf, B)] = '\0';
+
+   strlcpy(ratebuf, ?, sizeof ratebuf);
+   fmt_scaled(st.bytes * 100.0 / microsecs, ratebuf);
+   ratebuf[strcspn(ratebuf, B)] = '\0';
+
(void)snprintf(buf[3], sizeof(buf[3]),
-   %qd bytes transferred in %ld.%03ld secs (%0.0f bytes/sec)\n,
-   (long long)st.bytes, nowtv.tv_sec, nowtv.tv_usec / 1000,
-   ((double)st.bytes * 100) / microsecs);
+   %qd bytes (%sB) transferred in %ld.%03ld seconds (%sB/s)\n,
+   (long long)st.bytes, sizebuf, nowtv.tv_sec, nowtv.tv_usec / 1000,
+   ratebuf);
 
iov[i].iov_base = buf[3];
iov[i++].iov_len = strlen(buf[3]);



cwm: cyclegroup and rcyclegroup broken.

2011-09-11 Thread Thomas Pfaff
This will probably sound familiar -- cyclegroup and rcyclegroup
is broken (again) and here's a patch to fix it ;-)

Index: group.c
===
RCS file: /cvs/xenocara/app/cwm/group.c,v
retrieving revision 1.51
diff -u -p -r1.51 group.c
--- group.c 25 Jul 2011 15:10:24 -  1.51
+++ group.c 11 Sep 2011 10:40:30 -
@@ -313,7 +313,7 @@ group_only(struct screen_ctx *sc, int id
  * Cycle through active groups.  If none exist, then just stay put.
  */
 void
-group_cycle(struct screen_ctx *sc, int reverse)
+group_cycle(struct screen_ctx *sc, int flags)
 {
struct group_ctx*gc, *showgroup = NULL;
 
@@ -321,11 +321,11 @@ group_cycle(struct screen_ctx *sc, int r
 
gc = sc-group_active;
for (;;) {
-   gc = reverse ? TAILQ_PREV(gc, group_ctx_q, entry) :
-   TAILQ_NEXT(gc, entry);
+   gc = (flags  CWM_RCYCLE) ? TAILQ_PREV(gc, group_ctx_q,
+   entry) : TAILQ_NEXT(gc, entry);
if (gc == NULL)
-   gc = reverse ? TAILQ_LAST(sc-groupq, group_ctx_q) :
-   TAILQ_FIRST(sc-groupq);
+   gc = (flags  CWM_RCYCLE) ? TAILQ_LAST(sc-groupq,
+   group_ctx_q) : TAILQ_FIRST(sc-groupq);
if (gc == sc-group_active)
break;



dd(1) support for uppercase size modifiers

2011-10-02 Thread Thomas Pfaff
Simple patch to allow uppercase size modifiers (K, M, and G).  Is there
a reason why not to?  Plus, as a bonus you're less likely to mess up if
you've been naughty and used dd on Linux.

Index: args.c
===
RCS file: /cvs/src/bin/dd/args.c,v
retrieving revision 1.18
diff -u -p -r1.18 args.c
--- args.c  27 Oct 2009 23:59:21 -  1.18
+++ args.c  2 Oct 2011 18:04:34 -
@@ -341,6 +341,7 @@ get_bsz(char *val)
++expr;
break;
case 'k':
+   case 'K':
t = num;
num *= 1024;
if (t  num)
@@ -348,6 +349,7 @@ get_bsz(char *val)
++expr;
break;
case 'm':
+   case 'M':
t = num;
num *= 1048576;
if (t  num)
@@ -411,6 +413,7 @@ get_off(char *val)
++expr;
break;
case 'k':
+   case 'K':
t = num;
num *= 1024;
if (t  num)
@@ -418,6 +421,7 @@ get_off(char *val)
++expr;
break;
case 'm':
+   case 'M':
t = num;
num *= 1048576;
if (t  num)



Re: dd(1) support for uppercase size modifiers

2011-10-02 Thread Thomas Pfaff
On Sun, 02 Oct 2011 14:38:42-0400
STeve Andre' and...@msu.edu wrote:

 On 10/02/11 14:25, Thomas Pfaff wrote:
  Simple patch to allow uppercase size modifiers (K, M, and G).  Is there
  a reason why not to?  Plus, as a bonus you're less likely to mess up if
  you've been naughty and used dd on Linux.
 
 What other commands allow case insensitive options?  I don't
 see it as desirable to emulate Linuxisms unless there is a good
 reason, myself.


Well, the point is not to emulate Linux (because then we'd have to change
the behavior of the lowercase suffixes among other things) but to be able
to use the same suffixes that tools with human-readable output displays,
like df -h, du -h, or ls -hl.  The fdisk and disklabel editors are
case-insensitive.



Re: dd(1) support for uppercase size modifiers

2011-10-08 Thread Thomas Pfaff
 Simple patch to allow uppercase size modifiers (K, M, and G).

I know this is not the most important thing in the world, but this
annoys me so I'm going to give it one last shot:

can somebody please give me one reason why this should not go in?

Look, when you ask various tools to display human-readable output
they do so using /uppercase/ characters.  Examples are disklabel,
bioctl, ls, df, du, and wc.  The fdisk and disklabel editors both
accept uppercase letters and so does newfs.

Why must dd be different?

Something about the rule of least surprise comes to mind ...

 Index: args.c
 ===
 RCS file: /cvs/src/bin/dd/args.c,v
 retrieving revision 1.18
 diff -u -p -r1.18 args.c
 --- args.c27 Oct 2009 23:59:21 -  1.18
 +++ args.c2 Oct 2011 18:04:34 -
 @@ -341,6 +341,7 @@ get_bsz(char *val)
   ++expr;
   break;
   case 'k':
 + case 'K':
   t = num;
   num *= 1024;
   if (t  num)
 @@ -348,6 +349,7 @@ get_bsz(char *val)
   ++expr;
   break;
   case 'm':
 + case 'M':
   t = num;
   num *= 1048576;
   if (t  num)
 @@ -411,6 +413,7 @@ get_off(char *val)
   ++expr;
   break;
   case 'k':
 + case 'K':
   t = num;
   num *= 1024;
   if (t  num)
 @@ -418,6 +421,7 @@ get_off(char *val)
   ++expr;
   break;
   case 'm':
 + case 'M':
   t = num;
   num *= 1048576;
   if (t  num)



dd disp option

2011-10-19 Thread Thomas Pfaff
This adds a new option disp that can be set to human for a more human-
readable completion message.  This does not change the current behavior.

  $ dd if=/dev/zero of=/tmp/kthxbye bs=1337K count=42 disp=human
  42+0 records in
  42+0 records out
  57501696 bytes (54.8MB) transferred in 0.161 seconds (340MB/s)

  $ dd if=/dev/zero of=/tmp/kthxbye bs=1337K count=42
  42+0 records in
  42+0 records out
  57501696 bytes transferred in 0.138 secs (415847262 bytes/sec)

You can add disp=legacy if you one day should decide to make disp=human
the default (yah).  Simple modification to scripts to keep them working.

I know you're all thrilled seeing yet another dd diff from me, but rest
assured; this is the last one ... for now ;-)

So, if anyone is interested:

Index: Makefile
===
RCS file: /cvs/src/bin/dd/Makefile,v
retrieving revision 1.5
diff -u -p -r1.5 Makefile
--- Makefile29 May 1998 04:34:20 -  1.5
+++ Makefile19 Oct 2011 18:50:31 -
@@ -2,5 +2,7 @@
 
 PROG=  dd
 SRCS=  args.c conv.c conv_tab.c dd.c misc.c position.c
+DPADD= ${LIBUTIL}
+LDADD= -lutil
 
 .include bsd.prog.mk
Index: args.c
===
RCS file: /cvs/src/bin/dd/args.c,v
retrieving revision 1.19
diff -u -p -r1.19 args.c
--- args.c  18 Oct 2011 09:37:35 -  1.19
+++ args.c  19 Oct 2011 18:50:31 -
@@ -53,6 +53,7 @@ static void   f_bs(char *);
 static voidf_cbs(char *);
 static voidf_conv(char *);
 static voidf_count(char *);
+static voidf_disp(char *);
 static voidf_files(char *);
 static voidf_ibs(char *);
 static voidf_if(char *);
@@ -72,6 +73,7 @@ static const struct arg {
{ cbs,f_cbs,  C_CBS,   C_CBS },
{ conv,   f_conv, 0,   0 },
{ count,  f_count,C_COUNT, C_COUNT },
+   { disp,   f_disp, 0,   0 },
{ files,  f_files,C_FILES, C_FILES },
{ ibs,f_ibs,  C_IBS,   C_BS|C_IBS },
{ if, f_if,   C_IF,C_IF },
@@ -197,6 +199,14 @@ f_count(char *arg)
 
if ((cpy_cnt = get_bsz(arg)) == 0)
cpy_cnt = (size_t)-1;
+}
+
+static void
+f_disp(char *arg)
+{
+
+   if ((disp_human = !strcmp(arg, human)) != 1)
+   errx(1, %s: illegal value, disp);
 }
 
 static void
Index: dd.1
===
RCS file: /cvs/src/bin/dd/dd.1,v
retrieving revision 1.25
diff -u -p -r1.25 dd.1
--- dd.118 Oct 2011 09:37:35 -  1.25
+++ dd.119 Oct 2011 18:50:31 -
@@ -137,6 +137,13 @@ Otherwise, input data is read and discar
 For pipes, the correct number of bytes is read.
 For all other devices, the correct number of blocks is read without
 distinguishing between a partial or complete block being read.
+.It Cm disp= Ns Ar s
+If
+.Ar s
+is
+.Sq human
+the completion message will be displayed in a more human-readable format
+using the appropriate size suffixes.
 .It Xo
 .Sm off
 .Cm conv= Ar value Oo ,
@@ -371,6 +378,9 @@ specification.
 .Pp
 The
 .Cm files
+operand,
+the
+.Cm disp
 operand,
 the conversions
 .Cm oldascii ,
Index: extern.h
===
RCS file: /cvs/src/bin/dd/extern.h,v
retrieving revision 1.7
diff -u -p -r1.7 extern.h
--- extern.h25 Jun 2003 21:12:30 -  1.7
+++ extern.h19 Oct 2011 18:50:31 -
@@ -57,6 +57,7 @@ extern STAT st;
 extern void (*cfunc)(void);
 extern size_t cpy_cnt;
 extern size_t cbsz;
+extern int disp_human;
 extern u_int ddflags;
 extern size_t files_cnt;
 extern const u_char *ctab;
Index: misc.c
===
RCS file: /cvs/src/bin/dd/misc.c,v
retrieving revision 1.16
diff -u -p -r1.16 misc.c
--- misc.c  27 Oct 2009 23:59:21 -  1.16
+++ misc.c  19 Oct 2011 18:50:31 -
@@ -45,10 +45,13 @@
 #include errno.h
 #include time.h
 #include unistd.h
+#include util.h
 
 #include dd.h
 #include extern.h
 
+intdisp_human;
+
 void
 summary(void)
 {
@@ -57,6 +60,7 @@ summary(void)
struct iovec iov[4];
double microsecs;
int i = 0;
+   char sizebuf[FMT_SCALED_STRSIZE], ratebuf[FMT_SCALED_STRSIZE];
 
(void)gettimeofday(nowtv, (struct timezone *)NULL);
timersub(nowtv, st.startv, nowtv);
@@ -85,10 +89,25 @@ summary(void)
iov[i].iov_base = buf[2];
iov[i++].iov_len = strlen(buf[2]);
}
-   (void)snprintf(buf[3], sizeof(buf[3]),
-   %qd bytes transferred in %ld.%03ld secs (%0.0f bytes/sec)\n,
-   (long long)st.bytes, nowtv.tv_sec, nowtv.tv_usec / 1000,
-   ((double)st.bytes * 100) / microsecs);
+
+   if (disp_human) {
+   strlcpy(sizebuf, ?, sizeof sizebuf);
+   fmt_scaled(st.bytes, sizebuf);
+   sizebuf[strcspn(sizebuf, 

Re: dd disp option

2011-10-20 Thread Thomas Pfaff
On Thu, 20 Oct 2011 09:39:46 +0100
Stuart Henderson s...@spacehopper.org wrote:
 dd is on the ramdisks, have you tested them at all?

No, I did not think about that, sorry, but this is a no-go anyway
as I was told that there will be no more non-standard options in dd.
I also promised myself to not nag about this so ... zip ;-)

 On 2011/10/19 21:12, Thomas Pfaff wrote:
  This adds a new option disp that can be set to human for a more human-
  readable completion message.  This does not change the current behavior.
  
$ dd if=/dev/zero of=/tmp/kthxbye bs=1337K count=42 disp=human
42+0 records in
42+0 records out
57501696 bytes (54.8MB) transferred in 0.161 seconds (340MB/s)
  
$ dd if=/dev/zero of=/tmp/kthxbye bs=1337K count=42
42+0 records in
42+0 records out
57501696 bytes transferred in 0.138 secs (415847262 bytes/sec)
  
  You can add disp=legacy if you one day should decide to make disp=human
  the default (yah).  Simple modification to scripts to keep them working.
[...]



Re: cron: fix incorrect error message

2012-05-08 Thread Thomas Pfaff
On Tue, 8 May 2012 09:55:53 -0400
Okan Demirmen o...@demirmen.com wrote:
 
 Not really a pasto; from putenv():
 
   P = (char **)realloc(lastenv, sizeof(char *) * (cnt + 2));

*puke*

Ok?

Index: setenv.c
===
RCS file: /cvs/src/lib/libc/stdlib/setenv.c,v
retrieving revision 1.13
diff -u -p -r1.13 setenv.c
--- setenv.c23 Aug 2010 22:31:50 -  1.13
+++ setenv.c8 May 2012 16:13:01 -
@@ -71,7 +71,7 @@ putenv(char *str)
for (P = environ; *P != NULL; P++)
;
cnt = P - environ;
-   P = (char **)realloc(lastenv, sizeof(char *) * (cnt + 2));
+   P = realloc(lastenv, sizeof(char *) * (cnt + 2));
if (!P)
return (-1);
if (lastenv != environ)
@@ -127,7 +127,7 @@ setenv(const char *name, const char *val
for (P = environ; *P != NULL; P++)
;
cnt = P - environ;
-   P = (char **)realloc(lastenv, sizeof(char *) * (cnt + 2));
+   P = realloc(lastenv, sizeof(char *) * (cnt + 2));
if (!P)
return (-1);
if (lastenv != environ)



Re: cron: fix incorrect error message

2012-05-08 Thread Thomas Pfaff
On Tue, 8 May 2012 18:22:51 +0200
Joerg Sonnenberger jo...@britannica.bec.de wrote:

 On Tue, May 08, 2012 at 06:19:55PM +0200, Thomas Pfaff wrote:
  On Tue, 8 May 2012 09:55:53 -0400
  Okan Demirmen o...@demirmen.com wrote:
   
   Not really a pasto; from putenv():
   
 P = (char **)realloc(lastenv, sizeof(char *) * (cnt + 2));
  
  *puke*
  
  Ok?
 
 If you want to drop the first cast, you might want to spell it
 sizeof(*P) as well...


Sure,

Index: setenv.c
===
RCS file: /cvs/src/lib/libc/stdlib/setenv.c,v
retrieving revision 1.13
diff -u -p -r1.13 setenv.c
--- setenv.c23 Aug 2010 22:31:50 -  1.13
+++ setenv.c8 May 2012 16:47:57 -
@@ -71,11 +71,11 @@ putenv(char *str)
for (P = environ; *P != NULL; P++)
;
cnt = P - environ;
-   P = (char **)realloc(lastenv, sizeof(char *) * (cnt + 2));
+   P = realloc(lastenv, sizeof(*P) * (cnt + 2));
if (!P)
return (-1);
if (lastenv != environ)
-   memcpy(P, environ, cnt * sizeof(char *));
+   memcpy(P, environ, cnt * sizeof(*P));
lastenv = environ = P;
environ[cnt] = str;
environ[cnt + 1] = NULL;
@@ -127,11 +127,11 @@ setenv(const char *name, const char *val
for (P = environ; *P != NULL; P++)
;
cnt = P - environ;
-   P = (char **)realloc(lastenv, sizeof(char *) * (cnt + 2));
+   P = realloc(lastenv, sizeof(*P) * (cnt + 2));
if (!P)
return (-1);
if (lastenv != environ)
-   memcpy(P, environ, cnt * sizeof(char *));
+   memcpy(P, environ, cnt * sizeof(*P));
lastenv = environ = P;
offset = cnt;
environ[cnt + 1] = NULL;



Re: cwm tiling

2012-06-08 Thread Thomas Pfaff
On Fri, 8 Jun 2012 13:57:35 -0400
Okan Demirmen o...@demirmen.com wrote:

 On Fri 2012.06.08 at 19:40 +0200, Thomas Pfaff wrote:
  On Sun, 3 Jun 2012 21:07:13 +0400
  Alexander Polakov p...@sdf.org wrote:
  
   I'd like to start a discussion about adding tiling to cwm with
   these two diffs.
  
  I don't want it ;-)
  
  If I wanted a tiling window manager I'd install one of the many
  already available.  Please keep cwm clean and simple, as it is.
 
 It's not being dropped as an idea at all.  Defaults will not change
 however.
 

Doing this means more code (more now and definitely more to come),
more documentation, more configuration options, more to learn, more
more more.

I appreciate that the defaults would stay the same, but really,
what is the point in doing this?  cwm can't be everything to
everyone.



Re: cwm tiling

2012-06-10 Thread Thomas Pfaff
On Sun, 10 Jun 2012 00:23:42 -0500
Todd T. Fries t...@fries.net wrote:
 Penned by Mike Belopuhov on 20120609  6:17.29, we have:
 | On Sat, Jun 9, 2012 at 12:41 PM, Stuart Henderson s...@spacehopper.org
 | wrote:
 |  personally, I do see benefit to having your diff or something like it with
 |  commands which can be bound that rearrange windows into certain layouts
 |  on-demand (though I think vtile would be a lot more useful than htile to
 |  many people with restricted vertical space ;)
 | 
 |  but I think that's far enough; to get cwm to work as a full-time tiling
 |  WM with window rearranging taking place all the time is going to need
 |  various hacks which just seem at odds with the basic design of cwm.

 On the tiling thread, so long as tiling is contained behind non default
 options and not seen otherwise, I don't see the harm.  Yes there's more
 code, but in this day and age size of the binary is not going to make a
 huge difference.

I'm not worried about the size of the binary, I'm more worried about
the number of lines of code this will end up adding; soon enough people
will send patches for this and that to suit their tiling needs.  Once
you go down that road ...



Re: cwm tiling

2012-06-10 Thread Thomas Pfaff
On Sat, 9 Jun 2012 13:17:29 +0200
Mike Belopuhov m...@crypt.org.ru wrote:
 currently users have to point
 the mouse cursor to where they want a new window to be created.
 otherwise the whole thing quickly turns into a mess of overlapped
 windows in the center of the screen.

This annoyed me too a while back because I open and close a bunch
of xterms and unless I jerk the mouse first they'd all overlap.

x=$(jot -r 1 0 XMAX)
y=$(jot -r 1 0 YMAX)
xterm -geometry 80x25+${x}+${y}

as a wrapper solved it.  Sure, this is only one program but the
other programs I open tend to stay open until I log out.

A knob to modify how new windows are placed could be useful,
but that's for another thread.



Re: sndio: protocol change - diff to test

2012-10-29 Thread Thomas Pfaff
On Sun, 28 Oct 2012 13:55:34 +0100
Alexandre Ratchov a...@caoua.org wrote:

 sorry; the previous diff is wrong, please consider the one
 below (thanks jsg@)
 
 Index: lib/libsndio/amsg.h
 ===
 RCS file: /cvs/src/lib/libsndio/amsg.h,v

Hi.

No noticable difference here after doing some light testing.

Cheers,
Thomas.



Re: cwm reload support

2012-10-30 Thread Thomas Pfaff
On Mon, 29 Oct 2012 19:32:16 -0400
Okan Demirmen o...@demirmen.com 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: [cwm 1/1] Add a menu to search and call internal functions.

2012-11-06 Thread Thomas Pfaff
Can you please provide a unified cvs diff?

I've not tried this patch but I have some comments (see below).

 Useful for those times you want to use an unbound function, but even
 when the function is bound to something you haven't memorized yet it
 can be faster than lookup up the keybinding in the manual.  Bound to
 CM-/ by default.

[...]

 +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} },
 @@ -399,6 +396,7 @@
   {.i = (CWM_LEFT|CWM_PTRMOVE|CWM_BIGMOVE)} },
   { bigptrmoveright, kbfunc_moveresize, 0,
   {.i = (CWM_RIGHT|CWM_PTRMOVE|CWM_BIGMOVE)} },
 + { NULL, NULL, 0, {0} }

Why do you insist on adding this?  Why not just use nitems?

 @@ -488,7 +486,8 @@
   return;
  
   for (iter = 0; iter  nitems(name_to_kbfunc); iter++) {
 - if (strcmp(name_to_kbfunc[iter].tag, binding) != 0)
 + if (name_to_kbfunc[iter].tag == NULL ||
 + strcmp(name_to_kbfunc[iter].tag, binding) != 0)
   continue;

See?  Now you have to add more code because you broke something.

 Index: cwm/kbfunc.c
 ===
 --- cwm.orig/kbfunc.c 2012-11-05 10:25:37.577424801 -0600
 +++ cwm/kbfunc.c  2012-11-05 14:17:27.164487245 -0600
 @@ -174,6 +174,35 @@
  }
  
  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++) {

Why not

for (iter = 0; iter  nitems(name_to_kbfunc); iter++) {
func = name_to_kbfunc[iter]; /* if you want to use func */

then you don't need the last NULL entry in the array or add code
to not break existing code.

 + if ((mi = menu_filter(sc, menuq, function, NULL, 0,
 + search_match_text, NULL)) != NULL) {
 + func = (struct func *)mi-ctx;
 + (*func-handler)(cc, func-argument);

func-handler(... is fine but some people prefer the pre-ANSI
C style, (*func-handler)(... ... Just a tiny nit.  YMMV.



Re: [cwm 1/1] Add a menu to search and call internal functions.

2012-11-07 Thread Thomas Pfaff
  Why not
  
  for (iter = 0; iter  nitems(name_to_kbfunc); iter++) {
  func = name_to_kbfunc[iter]; /* if you want to use func */
  
  then you don't need the last NULL entry in the array or add code
  to not break existing code.
 
 See: http://c-faq.com/decl/extarraysize.html
 
 The diff moves the declaration of name_to_kbfunc[] to calmwm.h and
 externs it for use in kbfunc.c, but it's still defined in conf.c.


Yeah, I see that now, though the use of nitems is used throughout
the code already and deviating from that and making that particular
array a special case seems kind of messy and somewhat confusing.



cwm rename iter to i (consistency)

2012-11-10 Thread Thomas Pfaff
Since we all seem to be playing with cwm these days, here's a patch
that renames iter to i used in for-loops.  conf.c used both, while
the rest of the code used i so I chose to use i.

Index: conf.c
===
RCS file: /cvs/xenocara/app/cwm/conf.c,v
retrieving revision 1.108
diff -u -p -r1.108 conf.c
--- conf.c  9 Nov 2012 03:52:02 -   1.108
+++ conf.c  10 Nov 2012 13:39:12 -
@@ -446,16 +446,15 @@ conf_bindname(struct conf *c, char *name
 {
struct keybinding   *current_binding;
char*substring, *tmp;
-   int  iter;
+   int  i;
 
current_binding = xcalloc(1, sizeof(*current_binding));
 
if ((substring = strchr(name, '-')) != NULL) {
-   for (iter = 0; iter  nitems(bind_mods); iter++) {
-   if ((tmp = strchr(name, bind_mods[iter].chr)) !=
+   for (i = 0; i  nitems(bind_mods); i++) {
+   if ((tmp = strchr(name, bind_mods[i].chr)) !=
NULL  tmp  substring) {
-   current_binding-modmask |=
-   bind_mods[iter].mask;
+   current_binding-modmask |= bind_mods[i].mask;
}
}
 
@@ -487,13 +486,13 @@ conf_bindname(struct conf *c, char *name
return;
}
 
-   for (iter = 0; iter  nitems(name_to_kbfunc); iter++) {
-   if (strcmp(name_to_kbfunc[iter].tag, binding) != 0)
+   for (i = 0; i  nitems(name_to_kbfunc); i++) {
+   if (strcmp(name_to_kbfunc[i].tag, binding) != 0)
continue;
 
-   current_binding-callback = name_to_kbfunc[iter].handler;
-   current_binding-flags = name_to_kbfunc[iter].flags;
-   current_binding-argument = name_to_kbfunc[iter].argument;
+   current_binding-callback = name_to_kbfunc[i].handler;
+   current_binding-flags = name_to_kbfunc[i].flags;
+   current_binding-argument = name_to_kbfunc[i].argument;
conf_grab(c, current_binding);
TAILQ_INSERT_TAIL(c-keybindingq, current_binding, entry);
return;
@@ -548,16 +547,15 @@ conf_mousebind(struct conf *c, char *nam
struct mousebinding *current_binding;
char*substring, *tmp;
const char  *errstr;
-   int  iter;
+   int  i;
 
current_binding = xcalloc(1, sizeof(*current_binding));
 
if ((substring = strchr(name, '-')) != NULL) {
-   for (iter = 0; iter  nitems(bind_mods); iter++) {
-   if ((tmp = strchr(name, bind_mods[iter].chr)) !=
+   for (i = 0; i  nitems(bind_mods); i++) {
+   if ((tmp = strchr(name, bind_mods[i].chr)) !=
NULL  tmp  substring) {
-   current_binding-modmask |=
-   bind_mods[iter].mask;
+   current_binding-modmask |= bind_mods[i].mask;
}
}
 
@@ -578,12 +576,12 @@ conf_mousebind(struct conf *c, char *nam
return;
}
 
-   for (iter = 0; iter  nitems(name_to_mousefunc); iter++) {
-   if (strcmp(name_to_mousefunc[iter].tag, binding) != 0)
+   for (i = 0; i  nitems(name_to_mousefunc); i++) {
+   if (strcmp(name_to_mousefunc[i].tag, binding) != 0)
continue;
 
-   current_binding-context = name_to_mousefunc[iter].context;
-   current_binding-callback = name_to_mousefunc[iter].handler;
+   current_binding-context = name_to_mousefunc[i].context;
+   current_binding-callback = name_to_mousefunc[i].handler;
TAILQ_INSERT_TAIL(c-mousebindingq, current_binding, entry);
return;
}



Add ATI Radeon HD 7850 to pcidevs

2012-11-19 Thread Thomas Pfaff
Add ATI Radeon HD 7850 to pcidevs.

I was unable to find product 0x6819 anywhere (lists mentioned in
pcidevs and Linux pci.ids) but I'm pretty sure it's correct ...

Index: pcidevs
===
RCS file: /cvs/src/sys/dev/pci/pcidevs,v
retrieving revision 1.1661
diff -u -p -r1.1661 pcidevs
--- pcidevs 17 Nov 2012 15:42:29 -  1.1661
+++ pcidevs 19 Nov 2012 14:42:47 -
@@ -1434,6 +1434,7 @@ product ATI RADEON_HD6310_2   0x9803  Rade
 product ATI RADEON_HD6250_10x9804  Radeon HD 6250
 product ATI RADEON_HD6250_20x9805  Radeon HD 6250
 product ATI RADEON_HD6320  0x9806  Radeon HD 6320
+product ATI RADEON_HD7850  0x6819  Radeon HD 7850
 product ATI RADEON_HD2600_HDA  0xaa08  Radeon HD 2600 HD Audio
 product ATI RS690M_HDA 0xaa10  RS690M HD Audio
 product ATI RADEON_HD3870_HDA  0xaa18  Radeon HD 3870 HD Audio



Re: Add ATI Radeon HD 7850 to pcidevs

2012-11-20 Thread Thomas Pfaff
On Mon, 19 Nov 2012 18:44:23 +0100
Thomas Pfaff tpf...@tp76.info wrote:

 Add ATI Radeon HD 7850 to pcidevs.

Sorted by PCI ID this time (dmesg also included).

Index: pcidevs
===
RCS file: /cvs/src/sys/dev/pci/pcidevs,v
retrieving revision 1.1661
diff -u -p -r1.1661 pcidevs
--- pcidevs 17 Nov 2012 15:42:29 -  1.1661
+++ pcidevs 20 Nov 2012 13:00:59 -
@@ -1262,6 +1262,7 @@ product ATI RADEON_X700_PCIE_S0x5e6d  Ra
 product ATI RADEON_X700_SE 0x5e4f  Radeon X700 SE
 product ATI RADEON_X700_SE_S   0x5e6f  Radeon X700 SE Sec
 product ATI RADEON_HD6670  0x6758  Radeon HD 6670
+product ATI RADEON_HD7850  0x6819  Radeon HD 7850
 product ATI RADEON_HD5800  0x6899  Radeon HD 5800
 product ATI RADEON_HD5700  0x68b8  Radeon HD 5700
 product ATI RADEON_HD5670  0x68d8  Radeon HD 5670


OpenBSD 5.2-current (GENERIC.MP) #21: Tue Nov 20 14:04:21 CET 2012
tpf...@ws.tp76.info:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 8535011328 (8139MB)
avail mem = 8285323264 (7901MB)
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.7 @ 0xeb520 (104 entries)
bios0: vendor American Megatrends Inc. version 1406 date 07/19/2012
bios0: ASUSTeK COMPUTER INC. P8Z77-V
acpi0 at bios0: rev 2
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP APIC FPDT MCFG HPET SSDT SSDT SSDT DMAR
acpi0: wakeup devices PS2M(S4) UAR1(S4) PS2K(S4) P0P1(S4) PXSX(S4) RP01(S4) 
PXSX(S4) RP02(S4) PXSX(S4) RP03(S4) PXSX(S4) RP04(S4) PXSX(S4) RP06(S4) 
PXSX(S4) RP07(S4) PXSX(S4) RP08(S4) PEGP(S4) PEG0(S4) PEG1(S4) PEG2(S4) 
PEG3(S4) PXSX(S4) RP05(S4) GLAN(S4) EHC1(S4) EHC2(S4) XHC_(S4) HDEF(S4) PWRB(S4)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM) i5-3550 CPU @ 3.30GHz, 3310.15 MHz
cpu0: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,LONG,LAHF,PERF,ITSC,FSGSBASE,SMEP,ERMS
cpu0: 256KB 64b/line 8-way L2 cache
cpu0: apic clock running at 100MHz
cpu1 at mainbus0: apid 2 (application processor)
cpu1: Intel(R) Core(TM) i5-3550 CPU @ 3.30GHz, 3309.72 MHz
cpu1: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,LONG,LAHF,PERF,ITSC,FSGSBASE,SMEP,ERMS
cpu1: 256KB 64b/line 8-way L2 cache
cpu2 at mainbus0: apid 4 (application processor)
cpu2: Intel(R) Core(TM) i5-3550 CPU @ 3.30GHz, 3309.72 MHz
cpu2: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,LONG,LAHF,PERF,ITSC,FSGSBASE,SMEP,ERMS
cpu2: 256KB 64b/line 8-way L2 cache
cpu3 at mainbus0: apid 6 (application processor)
cpu3: Intel(R) Core(TM) i5-3550 CPU @ 3.30GHz, 3309.72 MHz
cpu3: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,LONG,LAHF,PERF,ITSC,FSGSBASE,SMEP,ERMS
cpu3: 256KB 64b/line 8-way L2 cache
ioapic0 at mainbus0: apid 2 pa 0xfec0, version 20, 24 pins
acpimcfg0 at acpi0 addr 0xf800, bus 0-63
acpihpet0 at acpi0: 14318179 Hz
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus -1 (P0P1)
acpiprt2 at acpi0: bus 2 (RP01)
acpiprt3 at acpi0: bus -1 (RP02)
acpiprt4 at acpi0: bus -1 (RP03)
acpiprt5 at acpi0: bus 3 (RP04)
acpiprt6 at acpi0: bus -1 (RP06)
acpiprt7 at acpi0: bus 6 (RP07)
acpiprt8 at acpi0: bus 7 (RP08)
acpiprt9 at acpi0: bus 1 (PEG0)
acpiprt10 at acpi0: bus -1 (PEG1)
acpiprt11 at acpi0: bus -1 (PEG2)
acpiprt12 at acpi0: bus -1 (PEG3)
acpiprt13 at acpi0: bus 4 (RP05)
acpiprt14 at acpi0: bus 5 (PXSX)
acpiec0 at acpi0
acpiec at acpi0 not configured
acpicpu0 at acpi0: C3, C2, C1, PSS
acpicpu1 at acpi0: C3, C2, C1, PSS
acpicpu2 at acpi0: C3, C2, C1, PSS
acpicpu3 at acpi0: C3, C2, C1, PSS
acpipwrres0 at acpi0: FN00
acpipwrres1 at acpi0: FN01
acpipwrres2 at acpi0: FN02
acpipwrres3 at acpi0: FN03
acpipwrres4 at acpi0: FN04
acpitz0 at acpi0: critical temperature is 106 degC
acpitz1 at acpi0: critical temperature is 106 degC
acpibat0 at acpi0: BAT0 not present
acpibat1 at acpi0: BAT1 not present
acpibat2 at acpi0: BAT2 not present
acpibtn0 at acpi0: PWRB
acpibtn1 at acpi0: LID0
acpivideo0 at acpi0: GFX0
acpivout0 at acpivideo0: DD02
cpu0: Enhanced SpeedStep 3310 MHz: speeds: 3301, 3300, 3200, 3100, 2900, 2800, 
2700, 2600, 2400, 2300, 2200, 2100

Add ATI Radeon HD 7850 and 7850 HD Audio to pcidevs

2013-01-13 Thread Thomas Pfaff
Add ATI Radeon HD 7850 and 7850 HD Audio to pcidevs.

Verified with the Windows driver information (I was
unable to find these ids anywhere else).

Index: pcidevs
===
RCS file: /cvs/src/sys/dev/pci/pcidevs,v
retrieving revision 1.1664
diff -u -p -r1.1664 pcidevs
--- pcidevs 2 Jan 2013 05:45:41 -   1.1664
+++ pcidevs 13 Jan 2013 10:09:07 -
@@ -1263,6 +1263,7 @@ product ATI RADEON_X700_PCIE_S0x5e6d  Ra
 product ATI RADEON_X700_SE 0x5e4f  Radeon X700 SE
 product ATI RADEON_X700_SE_S   0x5e6f  Radeon X700 SE Sec
 product ATI RADEON_HD6670  0x6758  Radeon HD 6670
+product ATI RADEON_HD7850  0x6819  Radeon HD 7850
 product ATI RADEON_HD5800  0x6899  Radeon HD 5800
 product ATI RADEON_HD5700  0x68b8  Radeon HD 5700
 product ATI RADEON_HD5670  0x68d8  Radeon HD 5670
@@ -1512,6 +1513,7 @@ product ATI RADEON_HD5600_HDA 0xaa60  Rad
 product ATI RADEON_HD5470_HDA  0xaa68  Radeon HD 5470 Audio
 product ATI RADEON_HD6670_HDA  0xaa90  Radeon HD 6670 Audio
 product ATI RADEON_HD6400_HDA  0xaa98  Radeon HD 6400 Audio
+product ATI RADEON_HD7850_HDA  0xaab0  Radeon HD 7850 HD Audio
 product ATI RS100_AGP  0xcab0  RS100 AGP
 product ATI RS200_AGP  0xcab2  RS200 AGP
 product ATI RS250_AGP  0xcab3  RS250 AGP



Re: Add ATI Radeon HD 7850 and 7850 HD Audio to pcidevs

2013-01-13 Thread Thomas Pfaff
On Sun, 13 Jan 2013 12:18:50 + (UTC)
Alexey E. Suslikov alexey.susli...@gmail.com wrote:

 Thomas Pfaff tpfaff at tp76.info writes:
 
   product ATI RADEON_HD6400_HDA  0xaa98  Radeon HD 6400 Audio
  +product ATI RADEON_HD7850_HDA  0xaab0  Radeon HD 7850 HD Audio
 
 I think 7850 audio entry shouldn't say HD twice (see 6400).


product ATI RADEON_HD6310_HDA  0x1314  Radeon HD 6310 HD Audio

I'm not sure what's correct.



Re: suspend/resume woes on MSI Wind U-100

2010-07-17 Thread Thomas Pfaff
On Sat, 17 Jul 2010 17:28:30 +0200
David Coppa dco...@gmail.com wrote:

 I've attached dmesg and acpidump.
 
 [demime 1.01d removed an attachment of type application/octet-stream which 
 had a name of dmesg.boot]
 
 [demime 1.01d removed an attachment of type application/x-gzip which had a 
 name of wind.acpidump.tgz]


Put it in the message body or provide a URL.

I also have an MSI Wind U-100 and I'll try the latest snapshot as soon
as I get the time and report back how it works for me (rumours say there
are models of U-100 with different hardware so maybe my results will
be different than yours *shrug*)



Re: suspend/resume woes on MSI Wind U-100

2010-07-18 Thread Thomas Pfaff
On Sun, 18 Jul 2010 14:35:04 +0200
Thomas Pfaff tpf...@tp76.info wrote:

 On Sat, 17 Jul 2010 17:28:30 +0200
 David Coppa dco...@gmail.com wrote:
 
  Hi,
  
  I've put the latest snapshot on a MSI Wind U-100 netbook.
  
  ACPI suspend and resume would work great, even from X, but
  unfortunately after resume keyboard and mouse don't work anymore.
  
 
 The same happens on my system.
 

Oh, and I should probably add that the system seems to be working
just fine apart from the above.  E.g. I can ssh into the system
and everything seems to be alright.



Re: vr(4) diff

2010-12-10 Thread Thomas Pfaff
Since you're wondering, here's my mail to Mark ...

(I've used vr(4) on my router for some time and installed another one
 on another system and I've never had any problems, though the traffic
 has been minimal).

On Fri, 10 Dec 2010 12:18:03 -0500
Brynet bry...@gmail.com wrote:

 Mark Kettenis wrote:
  Here's an attempt to fix a potential MCLGETI issue with vr(4) similar
  to what I recently fixed fro re(4).  Unfortunately I don't have any
  vr(4) hardware myself, so I need some hep testing this.
  
  Things to look for are:
  
  1. Does this diff have any effect on throughput (packets/s, bits/s).
  
  2. Does this fix any problems with the interface if you blast it with
 packets?
  
  3. Does livelock mitigation actualy work?
  
  Thanks,
  
  Mark
 
 Hi Mark,
 
 Did you receive any feedback for this? is there an easy way to replicate
 the problems others are seeing, as my systems seem stable.
 
 Using this patch doesn't seem to cause any noticeable performance
 regressions.
 

On Sun, 5 Dec 2010 16:44:27 +0100 (CET)
Mark Kettenis mark.kette...@xs4all.nl wrote:

 Here's an attempt to fix a potential MCLGETI issue with vr(4) similar
 to what I recently fixed fro re(4).  Unfortunately I don't have any
 vr(4) hardware myself, so I need some hep testing this.

No apparent problems here.  I get the same speed and no hangs, though I
never encountered hangs before.  I just installed this card.  I'm running
the December 4th snapshot.  Kernel sources from yesterday, ran with and
without your patch.

Not sure what blast it with packets mean, but I ran iperf and tcpbench
quite a while.  If you have other tools you want me to use, let me know.

Speed was stable at 94.2 Mbps, BTW.

$ dmesg | grep vr0
vr0 at pci0 dev 9 function 0 VIA VT6105 RhineIII rev 0x86: irq 5, address 
00:11:95:e2:bb:a1
ukphy0 at vr0 phy 1: Generic IEEE 802.3u media interface, rev. 4: OUI 0x004063, 
model 0x0034

$ ifconfig vr0
vr0: flags=8843UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST mtu 1500
lladdr 00:11:95:e2:bb:a1
priority: 0
groups: egress
media: Ethernet autoselect (100baseTX full-duplex)
status: active
inet 10.0.0.7 netmask 0xff00 broadcast 10.0.0.255
inet6 fe80::211:95ff:fee2:bba1%vr0 prefixlen 64 scopeid 0x2

# pcidump -v 0:9:0
 0:9:0: VIA VT6105 RhineIII
0x: Vendor ID: 1106 Product ID: 3106
0x0004: Command: 0117 Status ID: 2210
0x0008: Class: 02 Subclass: 00 Interface: 00 Revision: 86
0x000c: BIST: 00 Header Type: 00 Latency Timer: 40 Cache Line Size: 08
0x0010: BAR io addr: 0xd000/0x0100
0x0014: BAR mem 32bit addr: 0xcfffcf00/0x0100
0x0018: BAR empty ()
0x001c: BAR empty ()
0x0020: BAR empty ()
0x0024: BAR empty ()
0x0028: Cardbus CIS: 
0x002c: Subsystem Vendor ID: 1186 Product ID: 1403
0x0030: Expansion ROM Base Address: cffe
0x0038: 
0x003c: Interrupt Pin: 01 Line: 05 Min Gnt: 03 Max Lat: 08
0x0040: Capability 0x01: Power Management

$ dmesg
OpenBSD 4.8-current (GENERIC) #1: Mon Dec  6 16:34:47 CET 2010
tpf...@hack.tp76.info:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: AMD Athlon(tm) XP 1800+ (AuthenticAMD 686-class, 256KB L2 cache) 1.53 
GHz
cpu0: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR,SSE
real mem  = 267939840 (255MB)
avail mem = 253505536 (241MB)
mainbus0 at root
bios0 at mainbus0: AT/286+ BIOS, date 04/29/02, BIOS32 rev. 0 @ 0xfdae0, SMBIOS 
rev. 2.3 @ 0xf0630 (23 entries)
bios0: vendor American Megatrends Inc. version 07.00T date 04/02/01
bios0: ECS K7S5A
apm0 at bios0: Power Management spec V1.2
apm0: AC on, no battery
acpi at bios0 function 0x0 not configured
pcibios0 at bios0: rev 2.1 @ 0xf/0x1
pcibios0: PCI IRQ Routing Table rev 1.0 @ 0xf7950/160 (8 entries)
pcibios0: PCI Interrupt Router at 000:02:0 (SiS 85C503 System rev 0x00)
pcibios0: PCI bus #1 is the last bus
bios0: ROM list: 0xc/0xc000 0xcc000/0x8000
cpu0 at mainbus0: (uniprocessor)
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 0 function 0 SiS 735 PCI rev 0x01
sisagp0 at pchb0
agp0 at sisagp0: aperture at 0xd000, size 0x200
ppb0 at pci0 dev 1 function 0 SiS 86C201 AGP rev 0x00
pci1 at ppb0 bus 1
vga1 at pci1 dev 0 function 0 ATI Rage Pro rev 0x5c
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
pcib0 at pci0 dev 2 function 0 SiS 85C503 System rev 0x00
ohci0 at pci0 dev 2 function 2 SiS 5597/5598 USB rev 0x07: irq 11, version 
1.0, legacy support
ohci1 at pci0 dev 2 function 3 SiS 5597/5598 USB rev 0x07: irq 12, version 
1.0, legacy support
pciide0 at pci0 dev 2 function 5 SiS 5513 EIDE rev 0xd0: 735: DMA, channel 0 
wired to compatibility, channel 1 wired to compatibility
wd0 at pciide0 channel 0 drive 0: ST34321A
wd0: 32-sector PIO, LBA, 4103MB, 8404830 sectors

Re: vr(4) diff

2010-12-11 Thread Thomas Pfaff
On Sat, 11 Dec 2010 00:41:00 +
Stuart Henderson s...@spacehopper.org wrote:

 On 2010/12/10 12:18, Brynet wrote:
  Mark Kettenis wrote:
   Here's an attempt to fix a potential MCLGETI issue with vr(4) similar
   to what I recently fixed fro re(4).  Unfortunately I don't have any
   vr(4) hardware myself, so I need some hep testing this.
   
 to replicate, on a fast nearby machine:
 
 pkg_add netrate
 netblast ip.addr.of.vr 1234 5 10
 
 i typically saw hangs in a fraction of a second on a vr/geode system.
 to recover connect in on another nic or the console and ifconfig vrX down
 then ifconfig vrX up.

No such problems here.  I did the netblast thing from an Intel Core
2 (see previous post for dmesg) and the vr(4) never stopped working,
with or without the patch.  During the blast it becomes completely
unresponsive over ssh and serial but I guess that's to be expected.



pf: ugly error message when probability value out of range.

2010-12-13 Thread Thomas Pfaff
When specifying a probability attribute on a rule and the value is out of
range, pfctl reports the problem using the internal probability value, an
unsigned greater than UINT_MAX, rather than what you actually specified.

The accepted range is either a number between 0 and 1 or between 0 and 100
if followed by a % character (to specify the value in percent).

The pfctl rule output already display the probability value in percent:

# pfctl -sr | grep prob
pass in on em0 inet proto icmp all keep state probability 50%

so I think the error message should contain the value in percent also.

Below transcript is using current pfctl and patched pfctl (diff below):

# grep prob pf.conf
pass in on $int_if inet proto icmp all probability 1.1
# pfctl -f pf.conf
pf.conf:11: invalid probability: 4724464025.00
pfctl: Syntax error in config file: pf rules not loaded
# /usr/src/sbin/pfctl/obj/pfctl -f pf.conf
pf.conf:11: invalid probability: 1.1 (110%)
pfctl: Syntax error in config file: pf rules not loaded
#

Maybe something like this?

Index: parse.y
===
RCS file: /cvs/src/sbin/pfctl/parse.y,v
retrieving revision 1.594
diff -u -p -r1.594 parse.y
--- parse.y 24 Sep 2010 09:17:46 -  1.594
+++ parse.y 13 Dec 2010 16:28:43 -
@@ -2208,7 +2208,8 @@ filter_opt: USER uids {
 
p = floor($2 * UINT_MAX + 0.5);
if (p  0.0 || p  UINT_MAX) {
-   yyerror(invalid probability: %lf, p);
+   yyerror(invalid probability: %g (%g%%), $2,
+   $2 * 100);
YYERROR;
}
filter_opts.prob = (u_int32_t)p;



Fw: cwm: xev_reconfig - xu_reconfig

2010-12-15 Thread Thomas Pfaff
I sent the diff below to a few guys found in the cwm cvs log about a month
ago but no love, so I'm posting here.

The diff is not that important but here it is anyway.  It came about when
looking through the cwm code trying to fix a few bugs that I've uncovered
(though I've been unsuccessful so far).  More diffs like this to come, if
anyone cares.

BTW, who should I send things like this to, if not this list?

Begin forwarded message:
[...]

Move xev_reconfig from xevents.c to xutil.c and rename to xu_reconfig as
per XXX in calmwm.h.  While here, sort xu_* prototypes in calmwm.h to match
the order of definition in xutil.c.

Index: calmwm.h
===
RCS file: /cvs/xenocara/app/cwm/calmwm.h,v
retrieving revision 1.118
diff -u -p -r1.118 calmwm.h
--- calmwm.h22 May 2010 22:10:31 -  1.118
+++ calmwm.h17 Nov 2010 10:38:15 -
@@ -384,29 +384,27 @@ struct menu   *menu_filter(struct scree
 void (*)(struct menu *, int));
 voidmenu_init(struct screen_ctx *);
 
-/* XXX should be xu_ */
-void xev_reconfig(struct client_ctx *);
-
 voidxev_loop(void);
 
-voidxu_getatoms(void);
 int xu_ptr_grab(Window, int, Cursor);
-voidxu_btn_grab(Window, int, u_int);
 int xu_ptr_regrab(int, Cursor);
-voidxu_btn_ungrab(Window, int, u_int);
 voidxu_ptr_ungrab(void);
-voidxu_ptr_setpos(Window, int, int);
+voidxu_btn_grab(Window, int, u_int);
+voidxu_btn_ungrab(Window, int, u_int);
 voidxu_ptr_getpos(Window, int *, int *);
+voidxu_ptr_setpos(Window, int, int);
 voidxu_key_grab(Window, int, int);
 voidxu_key_ungrab(Window, int, int);
+voidxu_reconfig(struct client_ctx *);
 voidxu_sendmsg(Window, Atom, long);
 int xu_getprop(Window, Atom, Atom, long, u_char **);
 int xu_getstrprop(Window, Atom, char **);
-voidxu_setstate(struct client_ctx *, int);
 int xu_getstate(struct client_ctx *, int *);
+voidxu_setstate(struct client_ctx *, int);
+voidxu_getatoms(void);
+voidxu_setwmname(struct screen_ctx *);
 unsigned long   xu_getcolor(struct screen_ctx *, char *);
 voidxu_freecolor(struct screen_ctx *, unsigned long);
-voidxu_setwmname(struct screen_ctx *);
 
 int u_spawn(char *);
 voidu_exec(char *);
Index: client.c
===
RCS file: /cvs/xenocara/app/cwm/client.c,v
retrieving revision 1.76
diff -u -p -r1.76 client.c
--- client.c22 May 2010 22:10:31 -  1.76
+++ client.c17 Nov 2010 10:38:15 -
@@ -114,7 +114,7 @@ client_new(Window win, struct screen_ctx
XAddToSaveSet(X_Dpy, cc-win);
 
/* Notify client of its configuration. */
-   xev_reconfig(cc);
+   xu_reconfig(cc);
 
(state == IconicState) ? client_hide(cc) : client_unhide(cc);
xu_setstate(cc, cc-state);
@@ -390,14 +390,14 @@ client_resize(struct client_ctx *cc)
 
XMoveResizeWindow(X_Dpy, cc-win, cc-geom.x,
cc-geom.y, cc-geom.width, cc-geom.height);
-   xev_reconfig(cc);
+   xu_reconfig(cc);
 }
 
 void
 client_move(struct client_ctx *cc)
 {
XMoveWindow(X_Dpy, cc-win, cc-geom.x, cc-geom.y);
-   xev_reconfig(cc);
+   xu_reconfig(cc);
 }
 
 void
Index: xevents.c
===
RCS file: /cvs/xenocara/app/cwm/xevents.c,v
retrieving revision 1.50
diff -u -p -r1.50 xevents.c
--- xevents.c   25 Sep 2010 20:04:55 -  1.50
+++ xevents.c   17 Nov 2010 10:38:15 -
@@ -52,7 +52,6 @@ static voidxev_handle_clientmessage(XE
 static void xev_handle_randr(XEvent *);
 static void xev_handle_mappingnotify(XEvent *);
 
-
 void   (*xev_handlers[LASTEvent])(XEvent *) = {
[MapRequest] = xev_handle_maprequest,
[UnmapNotify] = xev_handle_unmapnotify,
@@ -166,7 +165,7 @@ xev_handle_configurerequest(XEvent *ee)
wc.border_width = cc-bwidth;
 
XConfigureWindow(X_Dpy, cc-win, e-value_mask, wc);
-   xev_reconfig(cc);
+   xu_reconfig(cc);
} else {
/* let it do what it wants, it'll be ours when we map it. */
wc.x = e-x;
@@ -211,25 +210,6 @@ test:
group_update_names(sc);
}
 
-}
-
-void
-xev_reconfig(struct client_ctx *cc)
-{
-   XConfigureEvent  ce;
-
-   ce.type = ConfigureNotify;
-   ce.event = cc-win;
- 

Re: pf debug states: ioctl interface and state names.

2010-12-22 Thread Thomas Pfaff
On Wed, 22 Dec 2010 09:03:57 +0100
Henning Brauer lists-openbsdt...@bsws.de wrote:

 * Thomas Pfaff tpf...@tp76.info [2010-12-21 22:19]:
[...]
  2) pf.conf(5) says set debug can be one of loud, misc, none, or urgent
  but if you set debug loud in pf.conf and load it the pfctl -sa output
  will say Debug: debug, or if you set debug misc it will say Debug:
  notice.  It does not say what you set in pf.conf.
  
  3) pfctl(8) -x option lets you set one of emerg, alert, crit, err,
  warning, notice, info, or debug.  These will show up by their correct
  name in pfctl -sa output.  They're also valid names in pf.conf so
  should they not also be mentioned in pf.conf(5)?
 
 yes. ryan cleaned that up big time to use syslog-like levels (i. e.
 your case 3). apparently we missed a few cases of the old ones (misc,
 loud etc).
 

So the names in 2) should be removed from the pf.conf man page and the
names in 3) should be added, then?  How about something like this (text
is mostly a copy of that in the pfctl man page for the -x option):

Index: pf.conf.5
===
RCS file: /cvs/src/share/man/man5/pf.conf.5,v
retrieving revision 1.482
diff -u -p -r1.482 pf.conf.5
--- pf.conf.5   15 Dec 2010 14:06:05 -  1.482
+++ pf.conf.5   22 Dec 2010 20:48:49 -
@@ -981,20 +981,12 @@ an ICMP UNREACHABLE is returned for bloc
 and all other packets are silently dropped.
 .El
 .It Ar set debug
-Set the debug
-.Ar level
-to one of the following:
-.Pp
-.Bl -tag -width  -compact
-.It Ar loud
-Generate debug messages for common conditions.
-.It Ar misc
-Generate debug messages for various errors.
-.It Ar none
-Don't generate debug messages.
-.It Ar urgent
-Generate debug messages only for serious errors.
-.El
+Set the debug level which limits the severity of log messages printed by pf(4).
+This should be a keyword from the following ordered list (highest to lowest):
+emerg, alert, crit, err, warning, notice, info, and debug.
+The last keyword, debug, must be quoted.
+These keywords correspond to the similar (LOG_) values specified to the
+syslog(3) library routine, and may be abbreviated.
 .It Ar set fingerprints
 Load fingerprints of known operating systems from the given filename.
 By default fingerprints of known operating systems are automatically



Re: pf debug states: ioctl interface and state names.

2010-12-26 Thread Thomas Pfaff
On Tue, 21 Dec 2010 22:15:33 +0100
Thomas Pfaff tpf...@tp76.info wrote:

 1) pf(4) says DIOCSETDEBUG has enum { PF_DEBUG_NONE, PF_DEBUG_URGENT, ...
 but these names are not in pfvar.h nor anywhere else in the source tree
 (AFAICT).  What should the legal values (or names) be?

I guess these should now be one of the LOG_ names from syslog(3) so
maybe something like this?

Not all LOG_ levels are used in the code, as far as I can tell, but I
guess that does not matter and might change in the future (so just do
a man page reference rather than list the currently used levels).

Index: pf.4
===
RCS file: /cvs/src/share/man/man4/pf.4,v
retrieving revision 1.71
diff -u -p -r1.71 pf.4
--- pf.431 May 2010 18:33:54 -  1.71
+++ pf.426 Dec 2010 21:30:29 -
@@ -26,7 +26,7 @@
 .\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\ SUCH DAMAGE.
 .\
-.Dd $Mdocdate: May 31 2010 $
+.Dd $Mdocdate: March 25 2010 $
 .Dt PF 4
 .Os
 .Sh NAME
@@ -316,10 +316,9 @@ struct pfioc_natlook {
 .Ed
 .It Dv DIOCSETDEBUG Fa u_int32_t *level
 Set the debug level.
-.Bd -literal
-enum   { PF_DEBUG_NONE, PF_DEBUG_URGENT, PF_DEBUG_MISC,
- PF_DEBUG_NOISY };
-.Ed
+See the
+.Xr syslog 3
+man page for a list of valid debug levels.
 .It Dv DIOCGETSTATES Fa struct pfioc_states *ps
 Get state table entries.
 .Bd -literal



cwm: maximization and alt-tab bug

2011-01-14 Thread Thomas Pfaff
There's a bug in cwm that screws up alt-tab if you follow the set of events
described in the next paragraph.  To regain alt-tab functionality you need
to jerk the mouse around to focus clients and then it usually comes back to
its senses again.

So, start with a clean root window.  Spawn two xterms, A and B, and place
them side-by-side at the top of the screen.  Focus B and vertically maximize
it.  Move ptr *near* bottom of B (below its original bottom y position).
Alt-tab to focus A.  Alt-tab to focus B.  Vertically unmaximize B (ptr will
now be over the root window) and alt-tab to A.  Now alt-tab will not focus B
and the ptr will be somewhere at the bottom of the root window.  Can anyone
else reproduce this?

It took a while to figure out the sequence of events that triggered this
problem and there might be other ways it can be triggered.  The same
happens if you maximize (fullscreen) or horizontally maximize the window
and move the ptr.

This patch fixes the problem for me.

Index: client.c
===
RCS file: /cvs/xenocara/app/cwm/client.c,v
retrieving revision 1.76
diff -u -p -r1.76 client.c
--- client.c22 May 2010 22:10:31 -  1.76
+++ client.c14 Jan 2011 17:27:39 -
@@ -273,6 +273,7 @@ client_maximize(struct client_ctx *cc)
 
if (cc-flags  CLIENT_MAXIMIZED) {
cc-geom = cc-savegeom;
+   cc-ptr.x = cc-ptr.y = -1;
} else {
if (!(cc-flags  (CLIENT_VMAXIMIZED | CLIENT_HMAXIMIZED)))
cc-savegeom = cc-geom;
@@ -312,6 +313,7 @@ client_vertmaximize(struct client_ctx *c
 
if (cc-flags  CLIENT_VMAXIMIZED) {
cc-geom = cc-savegeom;
+   cc-ptr.x = cc-ptr.y = -1;
} else {
if (!(cc-flags  (CLIENT_MAXIMIZED | CLIENT_HMAXIMIZED)))
cc-savegeom = cc-geom;
@@ -343,6 +345,7 @@ client_horizmaximize(struct client_ctx *
 
if (cc-flags  CLIENT_HMAXIMIZED) {
cc-geom = cc-savegeom;
+   cc-ptr.x = cc-ptr.y = -1;
} else {
if (!(cc-flags  (CLIENT_MAXIMIZED | CLIENT_VMAXIMIZED)))
cc-savegeom = cc-geom;



Re: cwm: maximization and alt-tab bug

2011-01-18 Thread Thomas Pfaff
On Tue, 18 Jan 2011 07:28:14 -0500
Okan Demirmen o...@demirmen.com wrote:

 On Fri 2011.01.14 at 19:19 +0100, Thomas Pfaff wrote:
  It took a while to figure out the sequence of events that triggered this
  problem and there might be other ways it can be triggered.  The same
  happens if you maximize (fullscreen) or horizontally maximize the window
  and move the ptr.
  
  This patch fixes the problem for me.
 
 how's this simplier one?


Seems good.  I'm not able to reproduce the problem and I've not been able
to accidentally reproduce it either.

 Index: client.c
 ===
 RCS file: /home/open/anoncvs/cvs/xenocara/app/cwm/client.c,v
 retrieving revision 1.76
 diff -u -p -r1.76 client.c
 --- client.c  22 May 2010 22:10:31 -  1.76
 +++ client.c  18 Jan 2011 12:23:37 -
 @@ -435,6 +435,8 @@ client_ptrsave(struct client_ctx *cc)
   if (client_inbound(cc, x, y)) {
   cc-ptr.x = x;
   cc-ptr.y = y;
 + } else {
 + cc-ptr.x = cc-ptr.y = -1;
   }
  }



Re: cwm(1) new option: windowspawn

2009-06-17 Thread Thomas Pfaff
On Wed, 17 Jun 2009 11:42:03 +0200
Thomas Pfaff tpf...@tp76.info wrote:
  
 +#define CONF_WS_CURSOR1
 +#define CONF_WS_CENTER2
 +#define CONF_WS_RANDOM3
 + int  windowspawn;

I suppose I could add CONF_WS_FULLSCREEN here, too, if anyone
is interested in any of this.  Same functionality as Alexander
Polakov tried to get in a while ago.



tee(1) cleanup

2009-06-19 Thread Thomas Pfaff
Just some cleaning up while I was surfing the code:

  * Sort headers + spacing (KNF)
  * Remove pointless casts
  * ssize_t for read(2) and write(2) return values

Index: tee.c
===
RCS file: /cvs/OpenBSD/src/usr.bin/tee/tee.c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 tee.c
--- tee.c   19 Jun 2009 18:35:19 -  1.1.1.1
+++ tee.c   19 Jun 2009 18:59:41 -
@@ -43,17 +43,18 @@ static char sccsid[] = @(#)tee.c   8.1 (B
 static char rcsid[] = $OpenBSD: tee.c,v 1.6 2003/06/10 22:20:53 deraadt Exp 
$;
 #endif
 
-#include sys/types.h
 #include sys/stat.h
-#include signal.h
+#include sys/types.h
+
+#include err.h
 #include errno.h
 #include fcntl.h
-#include unistd.h
+#include locale.h
+#include signal.h
 #include stdio.h
 #include stdlib.h
 #include string.h
-#include locale.h
-#include err.h
+#include unistd.h
 
 typedef struct _list {
struct _list *next;
@@ -68,17 +69,17 @@ int
 main(int argc, char *argv[])
 {
LIST *p;
-   int n, fd, rval, wval;
-   char *bp;
+   int fd;
+   ssize_t n, rval, wval;
int append, ch, exitval;
-   char *buf;
-#defineBSIZE (8 * 1024)
+   char *bp, *buf;
+#defineBSIZE (8U * 1024U)
 
setlocale(LC_ALL, );
 
append = 0;
while ((ch = getopt(argc, argv, ai)) != -1)
-   switch((char)ch) {
+   switch(ch) {
case 'a':
append = 1;
break;
@@ -93,7 +94,7 @@ main(int argc, char *argv[])
argv += optind;
argc -= optind;
 
-   if ((buf = malloc((size_t)BSIZE)) == NULL)
+   if ((buf = malloc(BSIZE)) == NULL)
err(1, NULL);
 
add(STDOUT_FILENO, stdout);
@@ -139,7 +140,7 @@ add(int fd, char *name)
 {
LIST *p;
 
-   if ((p = malloc((size_t)sizeof(LIST))) == NULL)
+   if ((p = malloc(sizeof(LIST))) == NULL)
err(1, NULL);
p-fd = fd;
p-name = name;



Re: azalia(4) diff needs testing.

2009-06-23 Thread Thomas Pfaff
On Tue, 23 Jun 2009 01:42:49 +
Jacob Meuser jake...@sdf.lonestar.org wrote:
 On Sun, Jun 21, 2009 at 01:07:37AM +, Jacob Meuser wrote:
Please test the following diff with any azalia(4) adapter, but 
especially
with any ATI or NVIDIA chipsets. Make sure sound still works properly
without any unusual sound artifacts.
 
 haven't gotten much feedback on this one ...
 

Works for me.

OpenBSD 4.6-beta (GENERIC.MP) #11: Tue Jun 23 08:56:12 CEST 2009
tpf...@ws.tp76.info:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 3152609280 (3006MB)
avail mem = 3044945920 (2903MB)
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.4 @ 0xf06b0 (76 entries)
bios0: vendor American Megatrends Inc. version 1704 date 11/27/2007
bios0: ASUSTeK Computer INC. P5B-E
acpi0 at bios0: rev 2
acpi0: tables DSDT FACP APIC MCFG OEMB HPET
acpi0: wakeup devices P0P2(S4) P0P1(S4) UAR1(S4) PS2K(S4) PS2M(S4) EUSB(S4) 
USBE(S4) P0P4(S4) P0P5(S4) P0P6(S4) P0P7(S4) P0P8(S4) P0P9(S4) USB0(S4) 
USB1(S4) USB2(S4) USB3(S4) USB4(S4) USB5(S4)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM)2 CPU 6400 @ 2.13GHz, 2562.37 MHz
cpu0: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,VMX,EST,TM2,CX16,xTPR,NXE,LONG
cpu0: 2MB 64b/line 8-way L2 cache
cpu0: apic clock running at 266MHz
cpu1 at mainbus0: apid 1 (application processor)
cpu1: Intel(R) Core(TM)2 CPU 6400 @ 2.13GHz, 2135.04 MHz
cpu1: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,VMX,EST,TM2,CX16,xTPR,NXE,LONG
cpu1: 2MB 64b/line 8-way L2 cache
ioapic0 at mainbus0 apid 2 pa 0xfec0, version 20, 24 pins
acpihpet0 at acpi0: 14318179 Hz
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 1 (P0P2)
acpiprt2 at acpi0: bus 5 (P0P1)
acpiprt3 at acpi0: bus 4 (P0P4)
acpiprt4 at acpi0: bus -1 (P0P5)
acpiprt5 at acpi0: bus -1 (P0P6)
acpiprt6 at acpi0: bus 3 (P0P7)
acpiprt7 at acpi0: bus 2 (P0P8)
acpicpu0 at acpi0: PSS
acpicpu1 at acpi0: PSS
acpibtn0 at acpi0: PWRB
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 Intel 82G965 Host rev 0x02
ppb0 at pci0 dev 1 function 0 Intel 82G965 PCIE rev 0x02: apic 2 int 16 (irq 
11)
pci1 at ppb0 bus 1
vga1 at pci1 dev 0 function 0 NVIDIA GeForce 7600 GT rev 0xa1
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
uhci0 at pci0 dev 26 function 0 Intel 82801H USB rev 0x02: apic 2 int 16 (irq 
11)
uhci1 at pci0 dev 26 function 1 Intel 82801H USB rev 0x02: apic 2 int 17 (irq 
5)
ehci0 at pci0 dev 26 function 7 Intel 82801H USB rev 0x02: apic 2 int 18 (irq 
15)
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 Intel EHCI root hub rev 2.00/1.00 addr 1
azalia0 at pci0 dev 27 function 0 Intel 82801H HD Audio rev 0x02: apic 2 int 
22 (irq 3)
azalia0: codecs: Analog Devices AD1988A
audio0 at azalia0
ppb1 at pci0 dev 28 function 0 Intel 82801H PCIE rev 0x02: apic 2 int 16 (irq 
11)
pci2 at ppb1 bus 4
ppb2 at pci0 dev 28 function 3 Intel 82801H PCIE rev 0x02: apic 2 int 19 (irq 
10)
pci3 at ppb2 bus 3
age0 at pci3 dev 0 function 0 Attansic Technology L1 rev 0xb0: apic 2 int 19 
(irq 10), address 00:18:f3:9d:7d:04
atphy0 at age0 phy 0: F1 10/100/1000 PHY, rev. 5
ppb3 at pci0 dev 28 function 4 Intel 82801H PCIE rev 0x02: apic 2 int 16 (irq 
11)
pci4 at ppb3 bus 2
jmb0 at pci4 dev 0 function 0 JMicron JMB363 IDE/SATA rev 0x02
ahci0 at jmb0: apic 2 int 16 (irq 11), AHCI 1.0
scsibus0 at ahci0: 32 targets
pciide0 at jmb0: DMA, channel 0 wired to native-PCI, channel 1 wired to 
native-PCI
pciide0: using apic 2 int 16 (irq 11) for native-PCI interrupt
atapiscsi0 at pciide0 channel 0 drive 0
scsibus1 at atapiscsi0: 2 targets
cd0 at scsibus1 targ 0 lun 0: PLEXTOR, DVDR PX-740A, 1.00 ATAPI 5/cdrom 
removable
cd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 2
pciide0: channel 1 disabled (no drives)
uhci2 at pci0 dev 29 function 0 Intel 82801H USB rev 0x02: apic 2 int 23 (irq 
7)
uhci3 at pci0 dev 29 function 1 Intel 82801H USB rev 0x02: apic 2 int 19 (irq 
10)
uhci4 at pci0 dev 29 function 2 Intel 82801H USB rev 0x02: apic 2 int 18 (irq 
15)
ehci1 at pci0 dev 29 function 7 Intel 82801H USB rev 0x02: apic 2 int 23 (irq 
7)
usb1 at ehci1: USB revision 2.0
uhub1 at usb1 Intel EHCI root hub rev 2.00/1.00 addr 1
ppb4 at pci0 dev 30 function 0 Intel 82801BA Hub-to-PCI rev 0xf2
pci5 at ppb4 bus 5
puc0 at pci5 dev 1 function 0 NetMos Nm9835 rev 0x01: ports: 1 com
com2 at puc0 port 0 apic 2 int 22 (irq 3): ns16550a, 16 byte fifo
re0 at pci5 dev 2 function 0 D-Link Systems DGE-528T rev 0x10: RTL8169/8110SB 
(0x1000), apic 2 int 23 (irq 7), address 00:21:91:12:15:03
rgephy0 at re0 phy 7: RTL8169S/8110S PHY, rev. 3
pcib0 at pci0 dev 31 function 0 Intel 82801H LPC rev 0x02
pciide1 at pci0 dev 31 function 2 Intel 82801H SATA rev 0x02: 

Re: cwm(1): exec globbing

2009-06-23 Thread Thomas Pfaff
On Wed, 17 Jun 2009 11:50:55 +0200
Thomas Pfaff tpf...@tp76.info wrote:
 This diff adds globbing to the exec function so you can type e.g.
 *ctl and get a list of all executable files that ends with ctl.

So, what's the verdict on this one?  The fnmatch lookup is case-
sensitive but I think that makes sense; if you use wildcards it
means you want your search to be more specific.

 Index: search.c
 ===
 RCS file: /cvs/OpenBSD/xenocara/app/cwm/search.c,v
 retrieving revision 1.1.1.1
 diff -u -p -r1.1.1.1 search.c
 --- search.c  17 Jun 2009 09:18:34 -  1.1.1.1
 +++ search.c  17 Jun 2009 09:48:17 -
 @@ -17,6 +17,7 @@
   * $Id: search.c,v 1.15 2009/05/18 00:23:35 okan Exp $
   */
  
 +#include fnmatch.h
  #include headers.h
  #include calmwm.h
  
 @@ -181,7 +182,8 @@ search_match_exec(struct menu_q *menuq, 
  
   TAILQ_FOREACH(mi, menuq, entry) {
   if (strsubmatch(search, mi-text, 1) == 0)
 - continue;
 + if (fnmatch(search, mi-text, 0) == FNM_NOMATCH)
 + continue;
   for (mj = TAILQ_FIRST(resultq); mj != NULL;
mj = TAILQ_NEXT(mj, resultentry)) {
   if (strcasecmp(mi-text, mj-text)  0) {



Re: azalia(4) diff needs testing.

2009-06-25 Thread Thomas Pfaff
On Thu, 25 Jun 2009 08:53:47 +0200
Thomas Pfaff tpf...@tp76.info wrote:
 On Thu, 25 Jun 2009 02:27:50 -0400
 Brad b...@comstyle.com wrote:
  
  Does that say ATI or NVIDIA?
 
 Well, true, but he initially said any azalia(4) adapter.
 
 I thought checking for regressions was important, too.
 

Meh ... he, as in you ;-)



Re: cwm - unmaximizing a widnow moves it back, too

2009-06-28 Thread Thomas Pfaff
On Mon, 15 Jun 2009 07:19:48 -0400
Okan Demirmen o...@demirmen.com wrote:
 On Mon 2009.06.15 at 11:46 +0200, Jan Stary wrote:
  This is 4.5-stable.
  
  In cwm, I use the C-M-f feature to toggle the 
  full-screen size of a window (mostly xterms). That works. However,
  if I maximize a window with C-M-f, then move it somewhere else
  (maximized), and then later unmaximize it again with C-M-f, the window
  not only resizes to its former size, but also moves back to its
  former location.
  
  Is this intentional?
 
 Hi Jan,
 
 Yes - this is intentional; for both the max (fullscreen) and vertmax
 cases; the position and dimensions get reset to pre-maximization values.
 
 The behavior of course can be changed, but I'm unlikely to want a knob
 for such a thing, so there would have to be a consensus.


This diff should take care of this.  Any objections?

Index: client.c
===
RCS file: /cvs/OpenBSD/xenocara/app/cwm/client.c,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -p -r1.2 -r1.2.2.1
--- client.c27 Jun 2009 08:20:23 -  1.2
+++ client.c28 Jun 2009 16:00:58 -  1.2.2.1
@@ -321,6 +321,11 @@ client_resize(struct client_ctx *cc)
 void
 client_move(struct client_ctx *cc)
 {
+   if (cc-flags  (CLIENT_MAXIMIZED|CLIENT_VMAXIMIZED)) {
+   cc-savegeom.x = cc-geom.x;
+   cc-savegeom.y = cc-geom.y;
+   }
+
XMoveWindow(X_Dpy, cc-win, cc-geom.x, cc-geom.y);
xev_reconfig(cc);
 }



Re: New installer - initial user creation

2009-06-28 Thread Thomas Pfaff
On Fri, 26 Jun 2009 13:09:27 +
Thordur I. Bjornsson t...@foo.is wrote:
 viq v...@viq.ath.cx wrote on Fri 26.Jun'09 at 14:45:04 +0200
 
  Since the user created during installation is somewhat marketed as root
  replacement, shouldn't he be added to staff login class ?
 
 Yes, I'd actually love that. Then I could use it.

While we're at it, would it not make sense to set /etc/mail/aliases to
this user as well?



Re: Asus WL-138gE donation

2009-07-23 Thread Thomas Pfaff
On Thu, 23 Jul 2009 16:04:39 +0200
Thomas Pfaff tpf...@tp76.info wrote:

 Any developer in need of an Asus WL-138gE PCI wireless adapter?

It's now taken.



Re: cwmrc(5) color options

2009-08-12 Thread Thomas Pfaff
On Fri, 7 Aug 2009 19:34:04 +0200
Simon Nicolussi simon.nicolu...@student.uibk.ac.at wrote:

 Edd Barrett wrote:
  How do the menu item foreground and background relate? Are they just
  inverted? It would be better to have an explicit option for each.
 
 An additional option to choose the color of the font in the selected
 entry has also been one of the suggestions made by Thomas Pfaff. This
 seems to require a bit more work, unfortunately. Maybe I'll take a look
 at it later or someone else will step in.

For the record, what I suggested on #openbsd was something like

  color menu fg/bg fgsel/bgsel

or

  color menu fg bg fgsel bgsel

the latter being slightly more consistent with regards to the gap
option, if that matters.

Not that I have anything to do with cwm, but personally I think
the current solution is a bit annoying and you really need to be
able to specify all four colors ;-)

Cheers,
Thomas



cwm(1): rip windowspawn

2009-08-15 Thread Thomas Pfaff
Just a note that no more work will be done on my windowspawn
diff as I've come to realize it might not end up being what
I initially wanted.

My reason for writing this was that I did not like my xterms
overlapping completely without jerking the mouse first, but
this can be solved in another way [1].

My last idea was to allow something like

  windowspawn where class[,name]

where `where' could be one of `center', `cursor', `fullscreen'
or `random' and class could be * to change the default
behaviour for all windows.  You could then add exceptions
for other classes.  Maybe it had some merit, but I don't
care that much about it any more (and I'm not sure anyone
else ever did ;-) ).

If anyone is dying for this feature, do let me know and I
might change my mind.

[1]
  x=$(jot -r 1 0 $((xres-termx)))
  y=$(jot -r 1 0 $((yres-termy)))
  xterm -geometry 80x30+${x}+${y}

Cheers,
Thomas



Re: atw testers required

2009-08-17 Thread Thomas Pfaff
On Mon, 17 Aug 2009 01:00:23 +0200
Jonathan Gray j...@goblin.cx wrote:

   /* XXX magic 0x1 */
 - test1 |= LSHIFT(0x1, ATW_TEST1_DBGREAD_MASK) | ATW_TEST1_CONTROL;
 + test1 |= (0x1  ATW_TEST1_DBGREAD_SHIFT) | ATW_TEST1_CONTROL;

I'm curious, what is the difference between 1  N and 0x1  N ?



Re: atw testers required

2009-08-17 Thread Thomas Pfaff
On Mon, 17 Aug 2009 12:44:59 +0200
Jonathan Gray j...@goblin.cx wrote:

 On Mon, Aug 17, 2009 at 12:09:17PM +0200, Thomas Pfaff wrote:
  On Mon, 17 Aug 2009 01:00:23 +0200
  Jonathan Gray j...@goblin.cx wrote:
 
 /* XXX magic 0x1 */
   - test1 |= LSHIFT(0x1, ATW_TEST1_DBGREAD_MASK) | ATW_TEST1_CONTROL;
   + test1 |= (0x1  ATW_TEST1_DBGREAD_SHIFT) | ATW_TEST1_CONTROL;
 
  I'm curious, what is the difference between 1  N and 0x1  N ?
 
 Well for example, this line previously expanded to:
 
 test1 |= ((0x1) 
 u_long)(((30))((28)))?((30)):((28))) + 1) == 32) ? 0 :
 ((u_int32_t) 1  (30))((28)))?((30)):((28))) + 1))) - 1) ^
 30))((28)))?((30)):((28 == 32) ? 0 : ((u_int32_t) 1 
 (30))((28)))?((30)):((28)) - 1 - 1) 
[...]

Wonderful ;-)

However, my question was not why not use the macro but why
specify 0x1 rather than just 1.

AFAIK there's no difference but the /* XXX magic 0x1 */ comment
seem to indicate otherwise and it got me curious, though no big
deal.

Thomas



Re: atw testers required

2009-08-17 Thread Thomas Pfaff
On Mon, 17 Aug 2009 14:26:08 +0200
Claudio Jeker cje...@diehard.n-r-g.com wrote:
  
  Seems a bit overkill to mark personal preference with XXX magic, but
  alright.  I'll go with that explanation ;-)
 
 The magic is for the value 1 (it does not matter if written 1 or 0x1) it
 seems that for some magic reason that bit needs to be set or the world
 stops spinning or something similar.

 Using hex notation for bitfields is more or less the standart as it is
 easier to convert then decimals.
 

I agree, and I tend to do this myself.

It's not very consistent throughout the code, though, but whatever.

There's no magic and that was my question ;-)



cwm: activate previous window on close

2009-08-19 Thread Thomas Pfaff
Here's a diff that activates the previously active window, or the window
now under the cursor, when the current window is closed.  This makes sure
you don't necessarily have to move the mouse or cycle windows to make one
active.

Anyone for?

Thomas

Index: client.c
===
RCS file: /cvs/OpenBSD/xenocara/app/cwm/client.c,v
retrieving revision 1.2
retrieving revision 1.1.1.1.6.10
diff -u -p -r1.2 -r1.1.1.1.6.10
--- client.c27 Jun 2009 08:20:23 -  1.2
+++ client.c19 Aug 2009 16:08:14 -  1.1.1.1.6.10
@@ -170,6 +170,14 @@ client_delete(struct client_ctx *cc)
client_freehints(cc);
xfree(cc);
 
+   /* Activate previously active window or window now under cursor. */
+   if ((cc = TAILQ_FIRST(sc-mruq)) != NULL) {
+   if ((cc-flags  (CLIENT_HIDDEN|CLIENT_IGNORE)) == 0) {
+   client_ptrwarp(cc);
+   client_setactive(cc, 1);
+   }
+   }
+
return (0);
 }



cwm: hmaximize

2009-08-20 Thread Thomas Pfaff
This diff adds a new command, hmaximize, that maximizes the current
window horizontally.  I find it useful when lines displayed by
commands are longer than my xterm; this way I can quickly maximize
horizontally and get the whole picture without lines wrapping.

Comments?

Index: calmwm.h
===
RCS file: /cvs/OpenBSD/xenocara/app/cwm/calmwm.h,v
retrieving revision 1.2
retrieving revision 1.2.14.4
diff -u -p -r1.2 -r1.2.14.4
--- calmwm.h27 Jun 2009 08:20:23 -  1.2
+++ calmwm.h20 Aug 2009 11:23:39 -  1.2.14.4
@@ -96,6 +96,8 @@ TAILQ_HEAD(screen_ctx_q, screen_ctx);
 #define CLIENT_MAXIMIZED   0x08
 #define CLIENT_DOVMAXIMIZE 0x10
 #define CLIENT_VMAXIMIZED  0x20
+#define CLIENT_DOHMAXIMIZE 0x40
+#define CLIENT_HMAXIMIZED  0x80
 
 #define CLIENT_HIGHLIGHT_GROUP 1
 #define CLIENT_HIGHLIGHT_UNGROUP   2
@@ -347,6 +349,7 @@ void client_ptrsave(struct 
client_ctx
 voidclient_draw_border(struct client_ctx *);
 voidclient_maximize(struct client_ctx *);
 voidclient_vertmaximize(struct client_ctx *);
+voidclient_horizmaximize(struct client_ctx *);
 voidclient_map(struct client_ctx *);
 voidclient_mtf(struct client_ctx *);
 struct client_ctx  *client_cycle(int);
@@ -434,6 +437,8 @@ void 
kbfunc_client_movetogroup(struct
 voidkbfunc_client_maximize(struct client_ctx *,
 union arg *);
 voidkbfunc_client_vmaximize(struct client_ctx *,
+union arg *);
+voidkbfunc_client_hmaximize(struct client_ctx *,
 union arg *);
 voidkbfunc_reload(struct client_ctx *, union arg *);
 voidkbfunc_quit_wm(struct client_ctx *, union arg *);
Index: client.c
===
RCS file: /cvs/OpenBSD/xenocara/app/cwm/client.c,v
retrieving revision 1.2
retrieving revision 1.2.12.5
diff -u -p -r1.2 -r1.2.12.5
--- client.c27 Jun 2009 08:20:23 -  1.2
+++ client.c20 Aug 2009 11:33:48 -  1.2.12.5
@@ -300,10 +300,43 @@ calc:
 }
 
 void
+client_horizmaximize(struct client_ctx *cc)
+{
+   struct screen_ctx   *sc = CCTOSC(cc);
+   int  x_org = 0, xmax = sc-xmax;
+
+   if (cc-flags  CLIENT_HMAXIMIZED) {
+   cc-geom = cc-savegeom;
+   } else {
+   if (!(cc-flags  CLIENT_MAXIMIZED))
+   cc-savegeom = cc-geom;
+   if (HasXinerama) {
+   XineramaScreenInfo *xine;
+   xine = screen_find_xinerama(CCTOSC(cc),
+   cc-geom.x + cc-geom.width / 2,
+   cc-geom.y + cc-geom.height / 2);
+   if (xine == NULL)
+   goto calc;
+   x_org = xine-x_org;
+   xmax = xine-width;
+   }
+calc:
+   cc-geom.x = x_org + Conf.gap_left;
+   cc-geom.width = xmax - (cc-bwidth * 2) - (Conf.gap_left +
+   Conf.gap_right);
+   cc-flags |= CLIENT_DOHMAXIMIZE;
+   }
+
+   client_resize(cc);
+}
+
+void
 client_resize(struct client_ctx *cc)
 {
-   if (cc-flags  (CLIENT_MAXIMIZED | CLIENT_VMAXIMIZED))
-   cc-flags = ~(CLIENT_MAXIMIZED | CLIENT_VMAXIMIZED);
+   if (cc-flags  (CLIENT_MAXIMIZED | CLIENT_VMAXIMIZED
+   | CLIENT_HMAXIMIZED))
+   cc-flags = ~(CLIENT_MAXIMIZED | CLIENT_VMAXIMIZED
+   | CLIENT_HMAXIMIZED);
 
if (cc-flags  CLIENT_DOMAXIMIZE) {
cc-flags = ~CLIENT_DOMAXIMIZE;
@@ -311,6 +344,9 @@ client_resize(struct client_ctx *cc)
} else if (cc-flags  CLIENT_DOVMAXIMIZE) {
cc-flags = ~CLIENT_DOVMAXIMIZE;
cc-flags |= CLIENT_VMAXIMIZED;
+   } else if (cc-flags  CLIENT_DOHMAXIMIZE) {
+   cc-flags = ~CLIENT_DOHMAXIMIZE;
+   cc-flags |= CLIENT_HMAXIMIZED;
}
 
XMoveResizeWindow(X_Dpy, cc-win, cc-geom.x,
Index: conf.c
===
RCS file: /cvs/OpenBSD/xenocara/app/cwm/conf.c,v
retrieving revision 1.2
retrieving revision 1.2.14.1
diff -u -p -r1.2 -r1.2.14.1
--- conf.c  27 Jun 2009 08:20:23 -  1.2
+++ conf.c  20 Aug 2009 11:18:02 -  1.2.14.1
@@ -338,6 +338,7 @@ static struct {
{ grouptoggle, kbfunc_client_grouptoggle, KBFLAG_NEEDCLIENT, {0}},
{ maximize, kbfunc_client_maximize, KBFLAG_NEEDCLIENT, {0} },
{ vmaximize, kbfunc_client_vmaximize, KBFLAG_NEEDCLIENT, {0} },
+   { hmaximize, kbfunc_client_hmaximize, KBFLAG_NEEDCLIENT, {0} },
{ reload, 

Re: cwm: hmaximize

2009-08-24 Thread Thomas Pfaff
On Mon, 24 Aug 2009 18:20:29 +0100
Owain Ainsworth zer...@googlemail.com wrote:

 On Mon, Aug 24, 2009 at 05:17:08PM +0100, Owain Ainsworth wrote:
  On Thu, Aug 20, 2009 at 01:50:37PM +0200, Thomas Pfaff wrote:
   This diff adds a new command, hmaximize, that maximizes the current
   window horizontally.  I find it useful when lines displayed by
   commands are longer than my xterm; this way I can quickly maximize
   horizontally and get the whole picture without lines wrapping.
   
   Comments?
 
 After discussion with okan@, here's a new diff, based on yours.
 
 It fixes the flags issue that I brought up, and adds a default
 keybinding (CMS-=). It works for me, but I don't have much use for
 horizontal maximisation.
 

Thank you.  I take it you're not against adding this option then,
so does anyone else object or have further comments?

Thanks.

Thomas



Re: uaudio diff to test

2009-10-10 Thread Thomas Pfaff
On Sat, 10 Oct 2009 15:28:33 +
Jacob Meuser jake...@sdf.lonestar.org wrote:
 
 please test with any and all USB audio devices.
 

Works for me.

OpenBSD 4.6-current (GENERIC.MP) #31: Sat Oct 10 18:41:10 CEST 2009
tpf...@ws.tp76.info:/usr/src/sys/arch/amd64/compile/GENERIC.MP
[...]

After the patch, I can also record from the device.

Before:

uaudio1 at uhub2 port 1 configuration 1 interface 0 Logitech Logitech USB 
Headset rev 1.10/10.13 addr 2
uaudio1: ignored input endpoint of type adaptive
uaudio1: audio rev 1.00, 6 mixer controls
audio2 at uaudio1

After:

uaudio1 at uhub2 port 1 configuration 1 interface 0 Logitech Logitech USB 
Headset rev 1.10/10.13 addr 2
uaudio1: audio rev 1.00, 6 mixer controls
audio2 at uaudio1


$ audioctl
name=USB audio
version=
config=uaudio
encodings=ulinear:8*,mulaw:8*,alaw:8*,slinear:8*,slinear_le:16,ulinear_le:16*,slinear_be:16*,ulinear_be:16*
properties=full_duplex,independent
full_duplex=0
fullduplex=0
blocksize=400
hiwat=163
lowat=122
output_muted=0
monitor_gain=0
mode=
play.rate=8000
play.channels=1
play.precision=8
play.encoding=mulaw
play.gain=127
play.balance=32
play.port=0x0
play.avail_ports=0x0
play.seek=0
play.samples=0
play.eof=0
play.pause=0
play.error=0
play.waiting=0
play.open=0
play.active=0
play.buffer_size=65536
play.block_size=400
play.errors=0
record.rate=8000
record.channels=1
record.precision=8
record.encoding=mulaw
record.gain=127
record.balance=32
record.port=0x0
record.avail_ports=0x0
record.seek=0
record.samples=0
record.eof=0
record.pause=0
record.error=0
record.waiting=0
record.open=0
record.active=0
record.buffer_size=65536
record.block_size=400
record.errors=0

$ mixerctl -v
outputs.spkr.mute=off  [ off on ]
outputs.spkr=121,121 volume
record.mic.mute=off  [ off on ]
record.mic=255 volume
inputs.mic.mute=on  [ off on ]
inputs.mic=0 volume

$ dmesg
OpenBSD 4.6-current (GENERIC.MP) #32: Sat Oct 10 21:24:34 CEST 2009
tpf...@ws.tp76.info:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 3152609280 (3006MB)
avail mem = 3066208256 (2924MB)
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.4 @ 0xf06b0 (76 entries)
bios0: vendor American Megatrends Inc. version 1704 date 11/27/2007
bios0: ASUSTeK Computer INC. P5B-E
acpi0 at bios0: rev 2
acpi0: tables DSDT FACP APIC MCFG OEMB HPET
acpi0: wakeup devices P0P2(S4) P0P1(S4) UAR1(S4) PS2K(S4) PS2M(S4) EUSB(S4) 
USBE(S4) P0P4(S4) P0P5(S4) P0P6(S4) P0P7(S4) P0P8(S4) P0P9(S4) USB0(S4) 
USB1(S4) USB2(S4) USB3(S4) USB4(S4) USB5(S4)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM)2 CPU 6400 @ 2.13GHz, 2562.37 MHz
cpu0: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,VMX,EST,TM2,CX16,xTPR,NXE,LONG
cpu0: 2MB 64b/line 8-way L2 cache
cpu0: apic clock running at 269MHz
cpu1 at mainbus0: apid 1 (application processor)
cpu1: Intel(R) Core(TM)2 CPU 6400 @ 2.13GHz, 2156.39 MHz
cpu1: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,VMX,EST,TM2,CX16,xTPR,NXE,LONG
cpu1: 2MB 64b/line 8-way L2 cache
ioapic0 at mainbus0: apid 2 pa 0xfec0, version 20, 24 pins
acpihpet0 at acpi0: 14318179 Hz
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 1 (P0P2)
acpiprt2 at acpi0: bus 5 (P0P1)
acpiprt3 at acpi0: bus 4 (P0P4)
acpiprt4 at acpi0: bus -1 (P0P5)
acpiprt5 at acpi0: bus -1 (P0P6)
acpiprt6 at acpi0: bus 3 (P0P7)
acpiprt7 at acpi0: bus 2 (P0P8)
acpicpu0 at acpi0: PSS
acpicpu1 at acpi0: PSS
aibs at acpi0 not configured
acpibtn0 at acpi0: PWRB
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 Intel 82G965 Host rev 0x02
ppb0 at pci0 dev 1 function 0 Intel 82G965 PCIE rev 0x02: apic 2 int 16 (irq 
11)
pci1 at ppb0 bus 1
vga1 at pci1 dev 0 function 0 NVIDIA GeForce 7600 GT rev 0xa1
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
uhci0 at pci0 dev 26 function 0 Intel 82801H USB rev 0x02: apic 2 int 16 (irq 
11)
uhci1 at pci0 dev 26 function 1 Intel 82801H USB rev 0x02: apic 2 int 17 (irq 
5)
ehci0 at pci0 dev 26 function 7 Intel 82801H USB rev 0x02: apic 2 int 18 (irq 
15)
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 Intel EHCI root hub rev 2.00/1.00 addr 1
azalia0 at pci0 dev 27 function 0 Intel 82801H HD Audio rev 0x02: apic 2 int 
22 (irq 3)
azalia0: codecs: Analog Devices AD1988A
audio0 at azalia0
ppb1 at pci0 dev 28 function 0 Intel 82801H PCIE rev 0x02: apic 2 int 16 (irq 
11)
pci2 at ppb1 bus 4
ppb2 at pci0 dev 28 function 3 Intel 82801H PCIE rev 0x02: apic 2 int 19 (irq 
10)
pci3 at ppb2 bus 3
age0 at pci3 dev 0 function 0 Attansic Technology L1 rev 0xb0: apic 2 int 19 
(irq 10), address 00:18:f3:9d:7d:04
atphy0 at age0 phy 0: F1 10/100/1000 PHY, rev. 5
ppb3 at pci0 dev 28 function 4 Intel 82801H PCIE rev 0x02: apic 2 int 16 (irq 
11)
pci4 at ppb3 bus 2

mixerctl(1) to sysctl(8); a simpler interface

2009-11-20 Thread Thomas Pfaff
Hi.

I've been thinking a bit about how to simplify the audio interface in
OpenBSD and I thought about sysctl.  Personally I find the mixerctl
interface horrible.  88 entries on my system, and I honestly do not
understand what half of it is for ;-)

I'm not trying to undermine the work put into this; it has been greatly
improved over the last 6 months or so, but all I really want to do is
simply adjust the input and output volume (and a few other things);

   sysctl snd.outputN.volume=[0,255]
   sysctl snd.inputN.volume[0,255]

or something like that.  Is this anything to pursue or should I just
leave it alone?

Cheers,
Thomas



Re: mixerctl(1) to sysctl(8); a simpler interface

2009-11-20 Thread Thomas Pfaff
On Fri, 20 Nov 2009 18:01:24 +0100
Alexandre Ratchov a...@caoua.org wrote:

  I'm not trying to undermine the work put into this; it has been greatly
  improved over the last 6 months or so, but all I really want to do is
  simply adjust the input and output volume (and a few other things);
  
 sysctl snd.outputN.volume=[0,255]
 sysctl snd.inputN.volume[0,255]
 
 Switching from ioctl to sysctl won't change the number of
 knobs, neither it will simplify their names.
 
 Additionnaly in the longer term, mixer knobs should use
 read(2) and write(2), so they can be polled, instead of a
 ioctl(2)-like interface. So sepending time on this wouldn't
 be very paying.
 

OK, I got the feedback I wanted.  Thanks all.  I'll continue
hating mixerctl(1) and hope something more sane show up in
the future ;-)

Cheers,
Thomas.



Re: mixerctl(1) to sysctl(8); a simpler interface

2009-11-21 Thread Thomas Pfaff
On Fri, 20 Nov 2009 20:29:08 +0100
Thomas Pfaff tpf...@tp76.info wrote:

 OK, I got the feedback I wanted.  Thanks all.  I'll continue
 hating mixerctl(1) and hope something more sane show up in
 the future ;-)
 

That was a bit harsh.  I do actually like mixerctl(1) for simpler
devices, like my uaudio(4) headset;

$ mixerctl -f /dev/mixer2
outputs.spkr.mute=off
outputs.spkr=121,121
record.mic.mute=off
record.mic=255
inputs.mic.mute=on
inputs.mic=0

Simple enough.  azalia(4) however has over 88 knobs on my system,
and I have to do a bit of guesswork to get e.g. recording to work,
but I suppose there's no easier way to do this while keeping the
features of azalia(4) present and controllable.

I know a lot of work has been put into azalia(4) by Jacob and as
I initially said, I in no way want to undermine that work.  What
I wanted was a simpler way of controlling the basic features of
the device.



Re: kernel hacking

2009-12-10 Thread Thomas Pfaff
On Thu, 10 Dec 2009 14:24:00 -0300
Robert Yuri robert.yu...@gmail.com wrote:

 which the best way to learn about OpenBSD kernel ?
 I found a bunch of docs from FreeBSD site such as developer's handbook at
 http://www.freebsd.org/doc/en_US.ISO8859-1/books/developers-handbook/ ,
 there any same that for openbsd ?
 
 thanks,
 ry
 

A few books on this topic in general worth mentioning is Modern Operating
Systems by Tanenbaum, Operating Systems: Design and Implementation.  The
latter one details the MINIX system, though.

Maybe others in here can chime in and come up with more recommendations.



cwm no blank labels

2010-01-17 Thread Thomas Pfaff
This diff disallows setting blank labels and pressing Esc while editing
the current one will leave it unchanged. I don't see the point in allowing
empty labels as the windows will just show up as blank entries in the menu.

Also remove `current' variable and just use `cc-label'.

Index: kbfunc.c
===
RCS file: /cvs/OpenBSD/xenocara/app/cwm/kbfunc.c,v
retrieving revision 1.6
retrieving revision 1.6.4.3
diff -u -p -r1.6 -r1.6.4.3
--- kbfunc.c22 Dec 2009 13:11:37 -  1.6
+++ kbfunc.c16 Jan 2010 17:01:54 -  1.6.4.3
@@ -400,18 +400,17 @@ kbfunc_client_label(struct client_ctx *c
 {
struct menu *mi;
struct menu_qmenuq;
-   char*current;
 
TAILQ_INIT(menuq);
 
-   current = cc-label;
-
-   if ((mi = menu_filter(cc-sc, menuq, label, current, 1,
+   if ((mi = menu_filter(cc-sc, menuq, label, cc-label, 1,
search_match_text, NULL)) != NULL) {
-   if (cc-label != NULL)
-   xfree(cc-label);
-   cc-label = xstrdup(mi-text);
-   xfree(mi);
+   if (strlen(mi-text)  0) {
+   if (cc-label != NULL)
+   xfree(cc-label);
+   cc-label = xstrdup(mi-text);
+   xfree(mi);
+   }
}
 }



Re: uvm_fault in uvm_rb_space

2010-02-02 Thread Thomas Pfaff
On Mon, 1 Feb 2010 23:01:46 -0800
Greg Steuck g...@nest.cx wrote:

 The other day amd64 4.6-release-ish locked up on me while starting a
 bunch of programs in X.

I think the standard answer here is can you please try running a current
snapshot and report back of the issue remains?.



Documenting offsetof(3)

2010-02-17 Thread Thomas Pfaff
offsetof(3) is not documented so here's a man page for it.

Is the text below enough or should it be more verbose?

.Dt OFFSETOF 3
.Os
.Sh NAME
.Nm offsetof
.Nd offset of a structure member
.Sh SYNOPSIS
.Fd #include stddef.h
.Ft size_t
.Fn offsetof type member
.Sh DESCRIPTION
The
.Fn offsetof
macro expands to an integer constant expression and yields the offset,
in bytes, of the field
.Ar member
from the start of the structure
.Ar type .
.Pp
A compiler error will result if
.Ar member
is not aligned to a byte boundary (i.e. it is a bit-field).
.Sh STANDARDS
The
.Fn offsetof
macro conforms to
.St -ansiC .



Re: Patch for boot for enabling gate A20 with BIOS

2010-03-01 Thread Thomas Pfaff
On Mon, 01 Mar 2010 18:51:31 +0100
Giuseppe Magnotta giuseppe.magno...@gmail.com wrote:

 My question is, if this functionality is available in the BIOS, why
 can't we use it?
 

I'm just jumping in here, but I think the obvious answer is; if it
is not needed on any existing platform, what purpose does it serve?



hw.sensors broke between 2010-04-15 and 2010-04-18

2010-04-24 Thread Thomas Pfaff
Hi.

On my current system sysctl hw.sensors does not show anything anymore.
Updating /usr/src/sys to 2010-04-15 gives me back the sensors.  Updating
/usr/src/sys to 2010-04-18 and the sensors are gone.  Something between
those two dates broke the sensors.

I'm not really sure where to go from here.  A cvs diff between the two
dates gives me a lot of changes but I'm not sure where to look.  I hope
someone more familiar with the sensors framework can make use of this
and find the actual commit that broke it.

I'm ready to test patches.

Cheers,
Thomas.

(dmesg from 2010-04-18 kernel)

OpenBSD 4.7-current (GENERIC.MP) #7: Sat Apr 24 15:47:26 CEST 2010
tpf...@ws.tp76.info:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 3152609280 (3006MB)
avail mem = 3060826112 (2919MB)
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.4 @ 0xf06b0 (76 entries)
bios0: vendor American Megatrends Inc. version 1704 date 11/27/2007
bios0: ASUSTeK Computer INC. P5B-E
acpi0 at bios0: rev 2
acpi0: tables DSDT FACP APIC MCFG OEMB HPET
acpi0: wakeup devices P0P2(S4) P0P1(S4) UAR1(S4) PS2K(S4) PS2M(S4) EUSB(S4) 
USBE(S4) P0P4(S4) P0P5(S4) P0P6(S4) P0P7(S4) P0P8(S4) P0P9(S4) USB0(S4) 
USB1(S4) USB2(S4) USB3(S4) USB4(S4) USB5(S4)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM)2 CPU 6400 @ 2.13GHz, 2135.33 MHz
cpu0: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,NXE,LONG
cpu0: 2MB 64b/line 8-way L2 cache
cpu0: apic clock running at 274MHz
cpu1 at mainbus0: apid 1 (application processor)
cpu1: Intel(R) Core(TM)2 CPU 6400 @ 2.13GHz, 2199.09 MHz
cpu1: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,NXE,LONG
cpu1: 2MB 64b/line 8-way L2 cache
ioapic0 at mainbus0: apid 2 pa 0xfec0, version 20, 24 pins
acpihpet0 at acpi0: 14318179 Hz
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 1 (P0P2)
acpiprt2 at acpi0: bus 5 (P0P1)
acpiprt3 at acpi0: bus 4 (P0P4)
acpiprt4 at acpi0: bus -1 (P0P5)
acpiprt5 at acpi0: bus -1 (P0P6)
acpiprt6 at acpi0: bus 3 (P0P7)
acpiprt7 at acpi0: bus 2 (P0P8)
acpicpu0 at acpi0: PSS
acpicpu1 at acpi0: PSS
aibs0 at acpi0
acpibtn0 at acpi0: PWRB
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 Intel 82G965 Host rev 0x02
ppb0 at pci0 dev 1 function 0 Intel 82G965 PCIE rev 0x02: apic 2 int 16 (irq 
11)
pci1 at ppb0 bus 1
vga1 at pci1 dev 0 function 0 NVIDIA GeForce 7600 GT rev 0xa1
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
uhci0 at pci0 dev 26 function 0 Intel 82801H USB rev 0x02: apic 2 int 16 (irq 
11)
uhci1 at pci0 dev 26 function 1 Intel 82801H USB rev 0x02: apic 2 int 17 (irq 
5)
ehci0 at pci0 dev 26 function 7 Intel 82801H USB rev 0x02: apic 2 int 18 (irq 
15)
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 Intel EHCI root hub rev 2.00/1.00 addr 1
azalia0 at pci0 dev 27 function 0 Intel 82801H HD Audio rev 0x02: apic 2 int 
22 (irq 3)
azalia0: codecs: Analog Devices AD1988A
audio0 at azalia0
ppb1 at pci0 dev 28 function 0 Intel 82801H PCIE rev 0x02: apic 2 int 16 (irq 
11)
pci2 at ppb1 bus 4
ppb2 at pci0 dev 28 function 3 Intel 82801H PCIE rev 0x02: apic 2 int 19 (irq 
10)
pci3 at ppb2 bus 3
age0 at pci3 dev 0 function 0 Attansic Technology L1 rev 0xb0: apic 2 int 19 
(irq 10), address 00:18:f3:9d:7d:04
atphy0 at age0 phy 0: F1 10/100/1000 PHY, rev. 5
ppb3 at pci0 dev 28 function 4 Intel 82801H PCIE rev 0x02: apic 2 int 16 (irq 
11)
pci4 at ppb3 bus 2
jmb0 at pci4 dev 0 function 0 JMicron JMB363 IDE/SATA rev 0x02
ahci0 at jmb0: apic 2 int 16 (irq 11), AHCI 1.0
scsibus0 at ahci0: 32 targets
pciide0 at jmb0: DMA, channel 0 wired to native-PCI, channel 1 wired to 
native-PCI
pciide0: using apic 2 int 16 (irq 11) for native-PCI interrupt
atapiscsi0 at pciide0 channel 0 drive 0
scsibus1 at atapiscsi0: 2 targets
cd0 at scsibus1 targ 0 lun 0: PLEXTOR, DVDR PX-740A, 1.00 ATAPI 5/cdrom 
removable
cd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 2
pciide0: channel 1 disabled (no drives)
uhci2 at pci0 dev 29 function 0 Intel 82801H USB rev 0x02: apic 2 int 23 (irq 
7)
uhci3 at pci0 dev 29 function 1 Intel 82801H USB rev 0x02: apic 2 int 19 (irq 
10)
uhci4 at pci0 dev 29 function 2 Intel 82801H USB rev 0x02: apic 2 int 18 (irq 
15)
ehci1 at pci0 dev 29 function 7 Intel 82801H USB rev 0x02: apic 2 int 23 (irq 
7)
usb1 at ehci1: USB revision 2.0
uhub1 at usb1 Intel EHCI root hub rev 2.00/1.00 addr 1
ppb4 at pci0 dev 30 function 0 Intel 82801BA Hub-to-PCI rev 0xf2
pci5 at ppb4 bus 5
puc0 at pci5 dev 1 function 0 NetMos Nm9835 rev 0x01: ports: 1 com
com2 at puc0 port 0 apic 2 int 22 (irq 3): ns16550a, 16 byte fifo
em0 at pci5 dev 2 function 0 Intel PRO/1000GT (82541GI) rev 0x05: apic 2 int 
23 

top.c revision 1.74 broke 'g' command

2010-04-24 Thread Thomas Pfaff
So, let's see if I'm less stupid this time.

Apr 24th snapshot.  Running top(1) and using the 'g' command makes top(1)
terminate with an error message saying top: Permission denied:.  Running
it as root says top: Undefined error:.

Reverting top.c to revision 1.73 and recompiling makes it work again.



Re: top.c revision 1.74 broke 'g' command

2010-04-24 Thread Thomas Pfaff
On Sat, 24 Apr 2010 22:31:56 +0200
Thomas Pfaff tpf...@tp76.info wrote:
 
 Reverting top.c to revision 1.73 and recompiling makes it work again.
 

And this diff should fix it (just an extra ; there) ...

Index: top.c
===
RCS file: /cvs/src/usr.bin/top/top.c,v
retrieving revision 1.74
diff -u -p -r1.74 top.c
--- top.c   21 Apr 2010 11:29:59 -  1.74
+++ top.c   24 Apr 2010 21:49:33 -
@@ -232,7 +232,7 @@ parseargs(int ac, char **av)
 
case 'g':   /* grep command name */
free(ps.command);
-   if((ps.command = strdup(optarg)) == NULL);
+   if((ps.command = strdup(optarg)) == NULL)
err(1, NULL);
break;



Re: top.c revision 1.74 broke 'g' command

2010-04-24 Thread Thomas Pfaff
On Sat, 24 Apr 2010 23:50:38 +0200
Thomas Pfaff tpf...@tp76.info wrote:

 On Sat, 24 Apr 2010 22:31:56 +0200
 Thomas Pfaff tpf...@tp76.info wrote:
  
  Reverting top.c to revision 1.73 and recompiling makes it work again.
  
 
 And this diff should fix it (just an extra ; there) ...
 

Oops, forgot the second fix.  Here it is.

Index: top.c
===
RCS file: /cvs/src/usr.bin/top/top.c,v
retrieving revision 1.74
diff -u -p -r1.74 top.c
--- top.c   21 Apr 2010 11:29:59 -  1.74
+++ top.c   24 Apr 2010 21:54:44 -
@@ -232,7 +232,7 @@ parseargs(int ac, char **av)
 
case 'g':   /* grep command name */
free(ps.command);
-   if((ps.command = strdup(optarg)) == NULL);
+   if((ps.command = strdup(optarg)) == NULL)
err(1, NULL);
break;
 
@@ -864,7 +864,7 @@ rundisplay(void)
ps.command = NULL;
else
if((ps.command = strdup(tempbuf)) ==
-   NULL);
+   NULL)
err(1, NULL);
putr();
} else



Fw: [patch] Re: fdisk and bootable flag

2010-05-12 Thread Thomas Pfaff
from misc@ (forgot to forward)

On Tue, 11 May 2010 22:14:26 +0200
Thomas Pfaff tpf...@tp76.info wrote:

 On Tue, 11 May 2010 12:34:28 -0700 (PDT)
 stupidmail4me stupidmail...@yahoo.com wrote:
  
  Anyone know how to edit the default MBR record so fdisk -iy creates
  one partition with no bootable flag, or how to unset the bootable flag?
 
 I think the following should do it:
 
 fdisk: 1 flag partition 0
 
 I suppose the man page should mention that this operation can take on
 a second operand.
 

diff if this should be mentioned.  It was in fact mentioned in the man
page but the text was commented out.  Not sure why.

Index: fdisk.8
===
RCS file: /cvs/src/sbin/fdisk/fdisk.8,v
retrieving revision 1.69
diff -u -p -r1.69 fdisk.8
--- fdisk.8 27 Mar 2010 13:56:49 -  1.69
+++ fdisk.8 12 May 2010 13:15:04 -
@@ -303,14 +303,14 @@ may be appended to indicate bytes, kilob
 The special size value
 .Sq *
 will cause the partition to be sized to use the remainder of the disk.
-.It Cm flag Ar #
+.It Cm flag Ar # Op Ar value
 Make the given MBR partition table entry bootable.
 Only one entry can be marked bootable.
 .\ If you wish to boot from an extended
 .\ MBR partition, you will need to mark the MBR partition table entry for the
 .\ extended MBR partition as bootable.
-.\ If an optional value is given, the MBR partition is marked with the given
-.\ value, and other MBR partitions are not touched.
+If an optional value is given, the MBR partition is marked with the given
+value, and other MBR partitions are not touched.
 .It Cm update
 Update the machine MBR bootcode and 0xAA55 signature in the memory copy
 of the currently selected boot block.