Re: ansify libarch/i386

2016-02-01 Thread Mark Kettenis
> From: j...@wxcvbn.org (=?utf-8?Q?J=C3=A9r=C3=A9mie_Courr=C3=A8ges-Anglas?=)
> Date: Mon, 01 Feb 2016 20:10:25 +0100
> 
> ok?

ok kettenis@

> Index: lib/libarch/i386/i386_get_ioperm.c
> ===
> RCS file: /cvs/src/lib/libarch/i386/i386_get_ioperm.c,v
> retrieving revision 1.7
> diff -u -p -r1.7 i386_get_ioperm.c
> --- lib/libarch/i386/i386_get_ioperm.c15 Nov 2014 02:23:28 -  
> 1.7
> +++ lib/libarch/i386/i386_get_ioperm.c31 Jan 2016 01:01:43 -
> @@ -36,8 +36,7 @@
>  #include 
>  
>  int
> -i386_get_ioperm(iomap)
> - u_long *iomap;
> +i386_get_ioperm(u_long *iomap)
>  {
>   struct i386_get_ioperm_args p;
>  
> Index: lib/libarch/i386/i386_get_ldt.c
> ===
> RCS file: /cvs/src/lib/libarch/i386/i386_get_ldt.c,v
> retrieving revision 1.4
> diff -u -p -r1.4 i386_get_ldt.c
> --- lib/libarch/i386/i386_get_ldt.c   15 Nov 2014 02:23:28 -  1.4
> +++ lib/libarch/i386/i386_get_ldt.c   31 Jan 2016 01:01:12 -
> @@ -33,10 +33,7 @@
>  #include 
>  
>  int
> -i386_get_ldt(start, desc, num)
> - int start;
> - union descriptor *desc;
> - int num;
> +i386_get_ldt(int start, union descriptor *desc, int num)
>  {
>   struct i386_get_ldt_args p;
>  
> Index: lib/libarch/i386/i386_iopl.c
> ===
> RCS file: /cvs/src/lib/libarch/i386/i386_iopl.c,v
> retrieving revision 1.7
> diff -u -p -r1.7 i386_iopl.c
> --- lib/libarch/i386/i386_iopl.c  15 Nov 2014 02:23:28 -  1.7
> +++ lib/libarch/i386/i386_iopl.c  30 Jan 2016 22:12:31 -
> @@ -36,8 +36,7 @@
>  #include 
>  
>  int
> -i386_iopl(iopl)
> - int iopl;
> +i386_iopl(int iopl)
>  {
>   struct i386_iopl_args p;
>  
> Index: lib/libarch/i386/i386_set_ioperm.c
> ===
> RCS file: /cvs/src/lib/libarch/i386/i386_set_ioperm.c,v
> retrieving revision 1.7
> diff -u -p -r1.7 i386_set_ioperm.c
> --- lib/libarch/i386/i386_set_ioperm.c15 Nov 2014 02:23:28 -  
> 1.7
> +++ lib/libarch/i386/i386_set_ioperm.c30 Jan 2016 22:12:54 -
> @@ -36,8 +36,7 @@
>  #include 
>  
>  int
> -i386_set_ioperm(iomap)
> - u_long *iomap;
> +i386_set_ioperm(u_long *iomap)
>  {
>   struct i386_set_ioperm_args p;
>  
> Index: lib/libarch/i386/i386_set_ldt.c
> ===
> RCS file: /cvs/src/lib/libarch/i386/i386_set_ldt.c,v
> retrieving revision 1.4
> diff -u -p -r1.4 i386_set_ldt.c
> --- lib/libarch/i386/i386_set_ldt.c   15 Nov 2014 02:23:28 -  1.4
> +++ lib/libarch/i386/i386_set_ldt.c   31 Jan 2016 01:01:25 -
> @@ -33,10 +33,7 @@
>  #include 
>  
>  int
> -i386_set_ldt(start, desc, num)
> - int start;
> - union descriptor *desc;
> - int num;
> +i386_set_ldt(int start, union descriptor *desc, int num)
>  {
>   struct i386_set_ldt_args p;
>  
> Index: lib/libarch/i386/i386_vm86.c
> ===
> RCS file: /cvs/src/lib/libarch/i386/i386_vm86.c,v
> retrieving revision 1.6
> diff -u -p -r1.6 i386_vm86.c
> --- lib/libarch/i386/i386_vm86.c  15 Nov 2014 02:23:28 -  1.6
> +++ lib/libarch/i386/i386_vm86.c  30 Jan 2016 22:14:00 -
> @@ -37,8 +37,7 @@
>  #include 
>  
>  int
> -i386_vm86(vmcp)
> - register struct vm86_struct *vmcp;
> +i386_vm86(struct vm86_struct *vmcp)
>  {
>  
>   return sysarch(I386_VM86, vmcp);
> 
> 
> -- 
> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE
> 
> 



Re: ldapd: add -r option to specify datadir path

2016-02-01 Thread Gleydson Soares
Hi Landry,

On Sun, Jan 31, 2016 at 09:39:52AM +0100, Landry Breuil wrote:
> Hi,
> 
> i'm tinkering with ldapd and writing regress tests for it, and to
> allow running independent instances (with separate port/control
> socket/etc) i needed to add the possibility to specify an alternative
> datadir, which was so far #defined in the code.
> Patch is pretty simple and works fine, i'm open to suggestions of course
> on a better wording for the manpage and option choose (i went for -r..)
> okays welcome too !

slight tweak,
looks like it is missing a chdir(3) to check failure if an invalid(nonexistent)
datadir was passed to optarg.

I just added these lines in ldapd.c:
159 if (datadir && chdir(datadir))
160 err(1, "chdir");

% doas ./ldapd -r /home/gsoares/non-existentdoas
ldapd: chdir: No such file or directory
% 

updated diff attached.
Index: ldapd.8
===
RCS file: /cvs/src/usr.sbin/ldapd/ldapd.8,v
retrieving revision 1.12
diff -u -p -r1.12 ldapd.8
--- ldapd.8 11 Aug 2014 08:21:55 -  1.12
+++ ldapd.8 1 Feb 2016 18:51:17 -
@@ -57,6 +57,11 @@ Use
 .Ar file
 as the configuration file, instead of the default
 .Pa /etc/ldapd.conf .
+.It Fl r Ar directory
+Store and read database files in
+.Ar directory
+, instead of the default
+.Pa /var/db/ldap .
 .It Fl n
 Configtest mode.
 Only check the configuration file for validity.
Index: ldapd.c
===
RCS file: /cvs/src/usr.sbin/ldapd/ldapd.c,v
retrieving revision 1.15
diff -u -p -r1.15 ldapd.c
--- ldapd.c 24 Dec 2015 17:47:57 -  1.15
+++ ldapd.c 1 Feb 2016 18:51:17 -
@@ -48,6 +48,7 @@ static voidldapd_log_verbose(struct im
 
 struct ldapd_stats  stats;
 pid_t   ldape_pid;
+char *  datadir;
 
 void
 usage(void)
@@ -55,7 +56,7 @@ usage(void)
extern char *__progname;
 
fprintf(stderr, "usage: %s [-dnv] [-D macro=value] "
-   "[-f file] [-s file]\n", __progname);
+   "[-f file] [-r directory] [-s file]\n", __progname);
exit(1);
 }
 
@@ -115,9 +116,10 @@ main(int argc, char *argv[])
struct event ev_sigchld;
struct event ev_sighup;
 
+   datadir = DATADIR;
log_init(1);/* log to stderr until daemonized */
 
-   while ((c = getopt(argc, argv, "dhvD:f:ns:")) != -1) {
+   while ((c = getopt(argc, argv, "dhvD:f:nr:s:")) != -1) {
switch (c) {
case 'd':
debug = 1;
@@ -137,6 +139,9 @@ main(int argc, char *argv[])
case 'n':
configtest = 1;
break;
+   case 'r':
+   datadir = optarg;
+   break;
case 's':
csockpath = optarg;
break;
@@ -174,6 +179,9 @@ main(int argc, char *argv[])
if (!skip_chroot && (pw = getpwnam(LDAPD_USER)) == NULL)
err(1, "%s", LDAPD_USER);
 
+   if (datadir && chdir(datadir))
+   err(1, "chdir");
+
if (!debug) {
if (daemon(1, 0) == -1)
err(1, "failed to daemonize");
@@ -343,7 +351,7 @@ ldapd_open_request(struct imsgev *iev, s
/* make sure path is null-terminated */
oreq->path[PATH_MAX] = '\0';
 
-   if (strncmp(oreq->path, DATADIR, strlen(DATADIR)) != 0) {
+   if (strncmp(oreq->path, datadir, strlen(datadir)) != 0) {
log_warnx("refusing to open file %s", oreq->path);
fatal("ldape sent invalid open request");
}
Index: namespace.c
===
RCS file: /cvs/src/usr.sbin/ldapd/namespace.c,v
retrieving revision 1.14
diff -u -p -r1.14 namespace.c
--- namespace.c 24 Dec 2015 17:47:57 -  1.14
+++ namespace.c 1 Feb 2016 18:51:17 -
@@ -38,6 +38,7 @@ static voidnamespace_queue_replay(int
 static int  namespace_set_fd(struct namespace *ns,
struct btree **bt, int fd, unsigned int flags);
 
+extern char*datadir;
 int
 namespace_begin_txn(struct namespace *ns, struct btree_txn **data_txn,
 struct btree_txn **indx_txn, int rdonly)
@@ -115,7 +116,7 @@ namespace_open(struct namespace *ns)
if (ns->sync == 0)
db_flags |= BT_NOSYNC;
 
-   if (asprintf(>data_path, "%s/%s_data.db", DATADIR, ns->suffix) < 0)
+   if (asprintf(>data_path, "%s/%s_data.db", datadir, ns->suffix) < 0)
return -1;
log_info("opening namespace %s", ns->suffix);
ns->data_db = btree_open(ns->data_path, db_flags | BT_REVERSEKEY, 0644);
@@ -124,7 +125,7 @@ namespace_open(struct namespace *ns)
 
btree_set_cache_size(ns->data_db, ns->cache_size);
 
-   if (asprintf(>indx_path, 

Re: ldapd: add -r option to specify datadir path

2016-02-01 Thread Landry Breuil
On Mon, Feb 01, 2016 at 07:37:34PM +0100, Jérémie Courrèges-Anglas wrote:
> j...@wxcvbn.org (Jérémie Courrèges-Anglas) writes:
> 
> > Sebastien Marie  writes:
> >
> >> On Sun, Jan 31, 2016 at 09:39:52AM +0100, Landry Breuil wrote:
> >>> Hi,
> >>> 
> >>> i'm tinkering with ldapd and writing regress tests for it, and to
> >>> allow running independent instances (with separate port/control
> >>> socket/etc) i needed to add the possibility to specify an alternative
> >>> datadir, which was so far #defined in the code.
> >>> Patch is pretty simple and works fine, i'm open to suggestions of course
> >>> on a better wording for the manpage and option choose (i went for -r..)
> >>> okays welcome too !
> >>> 
> >>
> >> the diff looks good and it would permit to make regress tests, so OK 
> >> semarie@ :)
> >
> > I have smallish tweaks to propose but nothing that prevents this diff to
> > go in as is.  ok jca@
> 
> Since both ldapd and ldapctl may access the db, ldapctl should be
> modified similarly.

Mh, i have to admit i thought ldapctl was sending imsgs commands to
ldapd to do the actual compact/reindexing instead of doing it offline..
so yes this makes sense, just add the chdir() check as gsoares@ proposed
for ldapd.

Landry



sunxi: fix sxipio func mask

2016-02-01 Thread Patrick Wildt
Hi,

in sxipio the mask is incorrect for get- and setcfg.

If bit is 1, off is (1 & 7) << 2, which is 4. That means each cfg is 4
bits wide, so the mask is 0xf and not 0x7.  I cross-checked it with
NetBSD and Linux.

As far as I know it does not fix any known issue for me, it's just
something that caught my eye.

Patrick

diff --git sys/arch/armv7/sunxi/sxipio.c sys/arch/armv7/sunxi/sxipio.c
index 9a49343..07a3c76 100644
--- sys/arch/armv7/sunxi/sxipio.c
+++ sys/arch/armv7/sunxi/sxipio.c
@@ -249,7 +249,7 @@ sxipio_getcfg(int pin)
 
splx(s);
 
-   return data >> off & 7;
+   return (data >> off) & 0xf;
 }
 
 void
@@ -263,7 +263,7 @@ sxipio_setcfg(int pin, int mux)
bit = pin - (port << 5);
reg = SXIPIO_CFG(port, bit >> 3);
off = (bit & 7) << 2;
-   cmask = 7 << off;
+   cmask = 0xf << off;
mask = mux << off;
 
s = splhigh();



Re: can't run multiple instances of httpd, flags not visible in processes

2016-02-01 Thread Stuart Henderson
On 2016/02/01 15:02, Joerg Jung wrote:
> What about smtpd, should be similar, no?

This would do the trick. It loses the getrlimit/setrlimit dance that
config_process() normally does, but I'm not sure if that is really
needed for the parent process anyway (mine only has 11 FDs so it's
not in any danger of running out).

Index: etc/rc.d/smtpd
===
RCS file: /cvs/src/etc/rc.d/smtpd,v
retrieving revision 1.5
diff -u -p -r1.5 smtpd
--- etc/rc.d/smtpd  26 Dec 2015 09:55:15 -  1.5
+++ etc/rc.d/smtpd  1 Feb 2016 19:22:33 -
@@ -6,7 +6,6 @@ daemon="/usr/sbin/smtpd"
 
 . /etc/rc.d/rc.subr
 
-pexp="smtpd: \[priv\]"
 rc_reload=NO
 
 rc_cmd $1
Index: usr.sbin/smtpd/smtpd.c
===
RCS file: /cvs/src/usr.sbin/smtpd/smtpd.c,v
retrieving revision 1.272
diff -u -p -r1.272 smtpd.c
--- usr.sbin/smtpd/smtpd.c  27 Jan 2016 12:46:03 -  1.272
+++ usr.sbin/smtpd/smtpd.c  1 Feb 2016 19:22:33 -
@@ -667,8 +667,6 @@ main(int argc, char *argv[])
 
fork_peers();
 
-   config_process(PROC_PARENT);
-
imsg_callback = parent_imsg;
event_init();
 



Re: can't run multiple instances of httpd, flags not visible in processes

2016-02-01 Thread Joerg Jung
On Mon, Feb 01, 2016 at 07:24:39PM +, Stuart Henderson wrote:
> On 2016/02/01 15:02, Joerg Jung wrote:
> > What about smtpd, should be similar, no?
> 
> This would do the trick. It loses the getrlimit/setrlimit dance that
> config_process() normally does, but I'm not sure if that is really
> needed for the parent process anyway (mine only has 11 FDs so it's
> not in any danger of running out).

I think that is fine and makes sense to me, ok jung@

But please wait for Gilles to comment.
 
> Index: etc/rc.d/smtpd
> ===
> RCS file: /cvs/src/etc/rc.d/smtpd,v
> retrieving revision 1.5
> diff -u -p -r1.5 smtpd
> --- etc/rc.d/smtpd26 Dec 2015 09:55:15 -  1.5
> +++ etc/rc.d/smtpd1 Feb 2016 19:22:33 -
> @@ -6,7 +6,6 @@ daemon="/usr/sbin/smtpd"
>  
>  . /etc/rc.d/rc.subr
>  
> -pexp="smtpd: \[priv\]"
>  rc_reload=NO
>  
>  rc_cmd $1
> Index: usr.sbin/smtpd/smtpd.c
> ===
> RCS file: /cvs/src/usr.sbin/smtpd/smtpd.c,v
> retrieving revision 1.272
> diff -u -p -r1.272 smtpd.c
> --- usr.sbin/smtpd/smtpd.c27 Jan 2016 12:46:03 -  1.272
> +++ usr.sbin/smtpd/smtpd.c1 Feb 2016 19:22:33 -
> @@ -667,8 +667,6 @@ main(int argc, char *argv[])
>  
>   fork_peers();
>  
> - config_process(PROC_PARENT);
> -
>   imsg_callback = parent_imsg;
>   event_init();
>  
> 



Re: ldapd: add -r option to specify datadir path

2016-02-01 Thread Jérémie Courrèges-Anglas
Gleydson Soares  writes:

> Hi Landry,
>
> On Sun, Jan 31, 2016 at 09:39:52AM +0100, Landry Breuil wrote:
>> Hi,
>> 
>> i'm tinkering with ldapd and writing regress tests for it, and to
>> allow running independent instances (with separate port/control
>> socket/etc) i needed to add the possibility to specify an alternative
>> datadir, which was so far #defined in the code.
>> Patch is pretty simple and works fine, i'm open to suggestions of course
>> on a better wording for the manpage and option choose (i went for -r..)
>> okays welcome too !
>
> slight tweak,
> looks like it is missing a chdir(3) to check failure if an 
> invalid(nonexistent)
> datadir was passed to optarg.
>
> I just added these lines in ldapd.c:
> 159   if (datadir && chdir(datadir))
> 160   err(1, "chdir");

Hum, while a check would be nicer, I prefer when daemons stick to /.

[...]

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



[Patch] (lack of) UTF-8 support in write(1)

2016-02-01 Thread Martijn van Duren

Hello tech@,

I've been working on this patch with schwarze@. It introduces UTF-8 
support in write(1), or more precise lack thereof.


The specifications say that write(1) should write characters to the 
console in conformance with the senders locale. Since the receiving tty 
might not be UTF-8 compatible it could cause undefined behaviour.


We settled on the fact that it would be wise to transform every 
non-ascii character to a '?' (this removes vis(3) support, since it 
doesn't make the text more readable) and detect UTF-8 continuation bytes 
so a single character doesn't cause a ? flooding.


I've also added support for bell, as specified by POSIX.

This is already OK schwarze@. Any other OKs/objections?

Index: write.1
===
RCS file: /cvs/src/usr.bin/write/write.1,v
retrieving revision 1.17
diff -u -p -r1.17 write.1
--- write.1 4 Jun 2014 06:07:32 -   1.17
+++ write.1 1 Feb 2016 18:47:44 -
@@ -117,9 +117,11 @@ The specified user is either not logged
 .Sh STANDARDS
 The
 .Nm
-utility is compliant with the
+utility is described in the
 .St -p1003.1-2008
-specification.
+specification. We break compliance in that we don't listen to the senders
+locale. Non ASCII characters will be transformed to a
+.Sq \? .
 .Sh HISTORY
 A
 .Nm
Index: write.c
===
RCS file: /cvs/src/usr.bin/write/write.c,v
retrieving revision 1.32
diff -u -p -r1.32 write.c
--- write.c 20 Oct 2015 20:21:18 -  1.32
+++ write.c 1 Feb 2016 18:47:44 -
@@ -34,20 +34,20 @@
  */

 #include 
+
 #include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
-#include 
 #include 
-#include 
-#include 
-#include 
 #include 
-#include 
 #include 
-#include 
-#include 

 void done(int sig);
 void do_write(char *, char *, uid_t);
@@ -55,6 +55,7 @@ void wr_fputs(char *);
 void search_utmp(char *, char *, int, char *, uid_t);
 int term_chk(char *, int *, time_t *, int);
 int utmp_chk(char *, char *);
+static int isu8cont(unsigned char c);

 int
 main(int argc, char *argv[])
@@ -296,24 +297,32 @@ done(int sig)
 void
 wr_fputs(char *s)
 {
-   u_char c;
-   char visout[5], *s2;

 #definePUTC(c) if (putchar(c) == EOF) goto err;

for (; *s != '\0'; ++s) {
-   c = toascii(*s);
-   if (c == '\n') {
+   if (*s == '\n') {
PUTC('\r');
PUTC('\n');
continue;
}
-   vis(visout, c, VIS_SAFE|VIS_NOSLASH, s[1]);
-   for (s2 = visout; *s2; s2++)
-   PUTC(*s2);
+   if (isu8cont(*s))
+   continue;
+   if (isprint(*s) || isspace(*s) || *s == '\a') {
+   PUTC(*s);
+   } else {
+   PUTC('?');
+   }
+
}
return;

 err:   err(1, NULL);
 #undef PUTC
+}
+
+static int
+isu8cont(unsigned char c)
+{
+   return (c & (0x80 | 0x40)) == 0x80;
 }



unused variable in init(8)

2016-02-01 Thread Jérémie Courrèges-Anglas

Not needed since rev. 1.55 and the introduction of crypt_checkpass().

ok?

Index: init.c
===
RCS file: /cvs/src/sbin/init/init.c,v
retrieving revision 1.57
diff -u -p -p -u -r1.57 init.c
--- init.c  23 Dec 2015 02:41:12 -  1.57
+++ init.c  1 Feb 2016 17:57:46 -
@@ -517,7 +517,7 @@ f_single_user(void)
struct passwd *pp;
static const char banner[] =
"Enter root password, or ^D to go multi-user\n";
-   char *clear, *password;
+   char *clear;
 #endif
 
/* Init shell and name */

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



multicast, ETOOMANYREFS and intro(2)

2016-02-01 Thread Jérémie Courrèges-Anglas

Hi,

while glancing at the multicast code I noticed the use of ETOOMANYREFS:

if (imo->imo_num_memberships == imo->imo_max_memberships) {
struct in_multi **nmships, **omships;
size_t newmax;
/*
 * Resize the vector to next power-of-two minus 1. If 
the
 * size would exceed the maximum then we know we've 
really
 * run out of entries. Otherwise, we reallocate the 
vector.
 */
nmships = NULL;
omships = imo->imo_membership;
newmax = ((imo->imo_max_memberships + 1) * 2) - 1;
if (newmax <= IP_MAX_MEMBERSHIPS) {
nmships = (struct in_multi **)malloc(
sizeof(*nmships) * newmax, M_IPMOPTS,
M_NOWAIT|M_ZERO);
if (nmships != NULL) {
memcpy(nmships, omships,
sizeof(*omships) *
imo->imo_max_memberships);
free(omships, M_IPMOPTS,
sizeof(*omships) *
imo->imo_max_memberships);
imo->imo_membership = nmships;
imo->imo_max_memberships = newmax;
}
}
if (nmships == NULL) {
error = ETOOMANYREFS;
if_put(ifp);
break;
}
}

intro(2) describes it as such:

  59 ETOOMANYREFS Too many references: can't splice. Not used in OpenBSD.

Obviously it *is* used, since rev. 1.1.  FreeBSD and NetBSD also make
use of it, but FreeBSD doesn't document it.

I don't know whether the kernel code should keep on using it, here's
a patch to fix the documentation:

Thoughts?

Index: lib/libc/sys/intro.2
===
RCS file: /cvs/src/lib/libc/sys/intro.2,v
retrieving revision 1.62
diff -u -p -r1.62 intro.2
--- lib/libc/sys/intro.21 Dec 2015 01:34:16 -   1.62
+++ lib/libc/sys/intro.231 Jan 2016 00:11:06 -
@@ -311,8 +311,6 @@ had already been shut down with a previo
 .Xr shutdown 2
 call.
 .It Er 59 ETOOMANYREFS Em "Too many references: can't splice" .
-Not used in
-.Ox .
 .It Er 60 ETIMEDOUT Em "Operation timed out" .
 A
 .Xr connect 2


-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



Re: sunxi: fix sxipio func mask

2016-02-01 Thread Patrick Wildt
On Mon, Feb 01, 2016 at 10:51:40PM +0200, Artturi Alm wrote:
> On Mon, Feb 01, 2016 at 09:06:35PM +0100, Patrick Wildt wrote:
> > Hi,
> > 
> > in sxipio the mask is incorrect for get- and setcfg.
> > 
> > If bit is 1, off is (1 & 7) << 2, which is 4. That means each cfg is 4
> > bits wide, so the mask is 0xf and not 0x7.  I cross-checked it with
> > NetBSD and Linux.
> > 
> > As far as I know it does not fix any known issue for me, it's just
> > something that caught my eye.
> > 
> > Patrick
> > 
> > diff --git sys/arch/armv7/sunxi/sxipio.c sys/arch/armv7/sunxi/sxipio.c
> > index 9a49343..07a3c76 100644
> > --- sys/arch/armv7/sunxi/sxipio.c
> > +++ sys/arch/armv7/sunxi/sxipio.c
> > @@ -249,7 +249,7 @@ sxipio_getcfg(int pin)
> >  
> > splx(s);
> >  
> > -   return data >> off & 7;
> > +   return (data >> off) & 0xf;
> >  }
> >  
> >  void
> > @@ -263,7 +263,7 @@ sxipio_setcfg(int pin, int mux)
> > bit = pin - (port << 5);
> > reg = SXIPIO_CFG(port, bit >> 3);
> > off = (bit & 7) << 2;
> > -   cmask = 7 << off;
> > +   cmask = 0xf << off;
> > mask = mux << off;
> >  
> > s = splhigh();
> > 
> 
> Hi,
> 
> i think you're wrong, "manuals" for both A10 are rather clear about this.
> last bit of each cfg is reserved, code doesn't touch the last bit on purpose.
> see A10 user manual rev1.2 page 288, or A20 user manual rev1.0 page 248 for
> example of one such cfg register(PA_CFG0).
> 
> -Artturi
> 

True that! I wonder if it would make sense to at least set the clear
mask to 0xf, so at least you don't write back whatever bit there
might be set or not set?

Bits are probably write ignored / read as zero.



[patch] vi enable -pedantic

2016-02-01 Thread Martijn van Duren

Hello tech@,

This patch enables -pedantic and does the appropriate cleanup that comes 
with it. It's mostly a CHAR_T->char conversion, which should be quite 
harmless, but edge-cases can be missed.


I'd like to have multiple OKs for this one as well as testing on 
multiple architectures, just to be sure.


The B1LEN, SKIP_PAST_NEWLINE, and PRIu32 are to silence clang with 
-pedantic.


Build and tested on amd64 with gcc, egcc and clang.

This drops the places CHAR_t can be found from 224 to 93.

martijn@

Index: build/Makefile
===
RCS file: /cvs/src/usr.bin/vi/build/Makefile,v
retrieving revision 1.23
diff -u -p -r1.23 Makefile
--- build/Makefile  6 Jan 2016 22:34:45 -   1.23
+++ build/Makefile  1 Feb 2016 22:06:45 -
@@ -4,7 +4,7 @@
 PROG=  vi

 # Modern curses (ncurses)
-CFLAGS+=-I${.CURDIR} -I${.CURDIR}/../include
+CFLAGS+=-pedantic -Werror -I${.CURDIR} -I${.CURDIR}/../include
 LDADD+=-lcurses
 DPADD+= ${LIBCURSES}

Index: cl/cl_term.c
===
RCS file: /cvs/src/usr.bin/vi/cl/cl_term.c,v
retrieving revision 1.21
diff -u -p -r1.21 cl_term.c
--- cl/cl_term.c6 Jan 2016 22:28:52 -   1.21
+++ cl/cl_term.c1 Feb 2016 22:06:45 -
@@ -30,7 +30,7 @@
 #include "../common/common.h"
 #include "cl.h"

-static int cl_pfmap(SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t);
+static int cl_pfmap(SCR *, seq_t, char *, size_t, char *, size_t);

 /*
  * XXX
@@ -170,10 +170,10 @@ cl_term_end(GS *gp)
  * cl_fmap --
  * Map a function key.
  *
- * PUBLIC: int cl_fmap(SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t);
+ * PUBLIC: int cl_fmap(SCR *, seq_t, char *, size_t, char *, size_t);
  */
 int
-cl_fmap(SCR *sp, seq_t stype, CHAR_T *from, size_t flen, CHAR_T *to,
+cl_fmap(SCR *sp, seq_t stype, char *from, size_t flen, char *to,
 size_t tlen)
 {
/* Ignore until the screen is running, do the real work then. */
@@ -190,7 +190,7 @@ cl_fmap(SCR *sp, seq_t stype, CHAR_T *fr
  * Map a function key (private version).
  */
 static int
-cl_pfmap(SCR *sp, seq_t stype, CHAR_T *from, size_t flen, CHAR_T *to,
+cl_pfmap(SCR *sp, seq_t stype, char *from, size_t flen, char *to,
 size_t tlen)
 {
size_t nlen;
Index: common/args.h
===
RCS file: /cvs/src/usr.bin/vi/common/args.h,v
retrieving revision 1.3
diff -u -p -r1.3 args.h
--- common/args.h   29 Jan 2001 01:58:28 -  1.3
+++ common/args.h   1 Feb 2016 22:06:45 -
@@ -22,7 +22,7 @@
  * is found.
  */
 typedef struct _args {
-   CHAR_T  *bp;/* Argument. */
+   char*bp;/* Argument. */
size_t   blen;  /* Buffer length. */
size_t   len;   /* Argument length. */

Index: common/exf.c
===
RCS file: /cvs/src/usr.bin/vi/common/exf.c,v
retrieving revision 1.41
diff -u -p -r1.41 exf.c
--- common/exf.c6 Jan 2016 22:29:38 -   1.41
+++ common/exf.c1 Feb 2016 22:06:45 -
@@ -54,10 +54,10 @@ static int  file_spath(SCR *, FREF *, str
  * vi now remembers the last location in any file that it has ever edited,
  * not just the previously edited file.
  *
- * PUBLIC: FREF *file_add(SCR *, CHAR_T *);
+ * PUBLIC: FREF *file_add(SCR *, char *);
  */
 FREF *
-file_add(SCR *sp, CHAR_T *name)
+file_add(SCR *sp, char *name)
 {
GS *gp;
FREF *frp, *tfrp;
@@ -922,7 +922,7 @@ file_write(SCR *sp, MARK *fm, MARK *tm,
case OLDFILE:
msgstr = LF_ISSET(FS_APPEND) ?
"%s: appended: %lu lines, %lu characters" :
-   "%s: %lu lines, %lu characters", NULL;
+   "%s: %lu lines, %lu characters";
len = snprintf(buf, sizeof(buf), msgstr, p, nlno, nch);
if (len >= sizeof(buf))
len = sizeof(buf) - 1;
Index: common/gs.h
===
RCS file: /cvs/src/usr.bin/vi/common/gs.h,v
retrieving revision 1.16
diff -u -p -r1.16 gs.h
--- common/gs.h 30 Jan 2016 21:23:50 -  1.16
+++ common/gs.h 1 Feb 2016 22:06:45 -
@@ -118,7 +118,7 @@ struct _gs {
(sp)->gp->cname[(unsigned char)(ch)].name :   \
v_key_name((sp), (ch)))
struct {
-   CHAR_T   name[MAX_CHARACTER_COLUMNS + 1];
+   char name[MAX_CHARACTER_COLUMNS + 1];
u_int8_t len;
} cname[MAX_FAST_KEY + 1];  /* Fast lookup table. */

@@ -165,7 +165,7 @@ struct _gs {
/* Ex: screen adjustment routine. */
int (*scr_ex_adjust)(SCR *, exadj_t);
int (*scr_fmap) /* Set a function key. */
-(SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t);
+(SCR *, seq_t, char *, size_t, char *, 

Re: sunxi: fix sxipio func mask

2016-02-01 Thread Artturi Alm
On Mon, Feb 01, 2016 at 10:14:38PM +0100, Patrick Wildt wrote:
> On Mon, Feb 01, 2016 at 10:51:40PM +0200, Artturi Alm wrote:
> > On Mon, Feb 01, 2016 at 09:06:35PM +0100, Patrick Wildt wrote:
> > > Hi,
> > > 
> > > in sxipio the mask is incorrect for get- and setcfg.
> > > 
> > > If bit is 1, off is (1 & 7) << 2, which is 4. That means each cfg is 4
> > > bits wide, so the mask is 0xf and not 0x7.  I cross-checked it with
> > > NetBSD and Linux.
> > > 
> > > As far as I know it does not fix any known issue for me, it's just
> > > something that caught my eye.
> > > 
> > > Patrick
> > > 
> > > diff --git sys/arch/armv7/sunxi/sxipio.c sys/arch/armv7/sunxi/sxipio.c
> > > index 9a49343..07a3c76 100644
> > > --- sys/arch/armv7/sunxi/sxipio.c
> > > +++ sys/arch/armv7/sunxi/sxipio.c
> > > @@ -249,7 +249,7 @@ sxipio_getcfg(int pin)
> > >  
> > >   splx(s);
> > >  
> > > - return data >> off & 7;
> > > + return (data >> off) & 0xf;
> > >  }
> > >  
> > >  void
> > > @@ -263,7 +263,7 @@ sxipio_setcfg(int pin, int mux)
> > >   bit = pin - (port << 5);
> > >   reg = SXIPIO_CFG(port, bit >> 3);
> > >   off = (bit & 7) << 2;
> > > - cmask = 7 << off;
> > > + cmask = 0xf << off;
> > >   mask = mux << off;
> > >  
> > >   s = splhigh();
> > > 
> > 
> > Hi,
> > 
> > i think you're wrong, "manuals" for both A10 are rather clear about 
> > this.
> > last bit of each cfg is reserved, code doesn't touch the last bit on 
> > purpose.
> > see A10 user manual rev1.2 page 288, or A20 user manual rev1.0 page 248 for
> > example of one such cfg register(PA_CFG0).
> > 
> > -Artturi
> > 
> 
> True that! I wonder if it would make sense to at least set the clear
> mask to 0xf, so at least you don't write back whatever bit there
> might be set or not set?
> 

don't know, and don't even really care atm., just noticed today that
according to man pages i'm not apparently author of any of sunxi drivers:P
and besides that, i still do have my own sys/arch/arm88k rewritten out of
sys/arch/arm & sys/arch/armv7 on top of m88k using armv7 userland, which
i've been able to maintain alone(diff to it has 0 + out of arch/arm88k ;).
i think hacking new stuff will never be as fun on armv7, given non-dev@ POV..

> Bits are probably write ignored / read as zero.

likely, would be easy to verify, but if 0xf is what linux and netbsd do use,
i guess it doesn't matter either way.

-Artturi



Re: ldapd: add -r option to specify datadir path

2016-02-01 Thread Gleydson Soares
On Mon, Feb 1, 2016 at 5:13 PM, Jérémie Courrèges-Anglas  
wrote:
> Gleydson Soares  writes:
>
>> Hi Landry,
>>
>> On Sun, Jan 31, 2016 at 09:39:52AM +0100, Landry Breuil wrote:
>>> Hi,
>>>
>>> i'm tinkering with ldapd and writing regress tests for it, and to
>>> allow running independent instances (with separate port/control
>>> socket/etc) i needed to add the possibility to specify an alternative
>>> datadir, which was so far #defined in the code.
>>> Patch is pretty simple and works fine, i'm open to suggestions of course
>>> on a better wording for the manpage and option choose (i went for -r..)
>>> okays welcome too !
>>
>> slight tweak,
>> looks like it is missing a chdir(3) to check failure if an 
>> invalid(nonexistent)
>> datadir was passed to optarg.
>>
>> I just added these lines in ldapd.c:
>> 159   if (datadir && chdir(datadir))
>> 160   err(1, "chdir");
>
> Hum, while a check would be nicer, I prefer when daemons stick to /.

It is. ldape() will take care right afterwards.



Re: sunxi: fix sxipio func mask

2016-02-01 Thread Jonathan Gray
On Tue, Feb 02, 2016 at 12:24:02AM +0200, Artturi Alm wrote:
> On Mon, Feb 01, 2016 at 10:14:38PM +0100, Patrick Wildt wrote:
> > On Mon, Feb 01, 2016 at 10:51:40PM +0200, Artturi Alm wrote:
> > > On Mon, Feb 01, 2016 at 09:06:35PM +0100, Patrick Wildt wrote:
> > > > Hi,
> > > > 
> > > > in sxipio the mask is incorrect for get- and setcfg.
> > > > 
> > > > If bit is 1, off is (1 & 7) << 2, which is 4. That means each cfg is 4
> > > > bits wide, so the mask is 0xf and not 0x7.  I cross-checked it with
> > > > NetBSD and Linux.
> > > > 
> > > > As far as I know it does not fix any known issue for me, it's just
> > > > something that caught my eye.
> > > > 
> > > > Patrick
> > > > 
> > > > diff --git sys/arch/armv7/sunxi/sxipio.c sys/arch/armv7/sunxi/sxipio.c
> > > > index 9a49343..07a3c76 100644
> > > > --- sys/arch/armv7/sunxi/sxipio.c
> > > > +++ sys/arch/armv7/sunxi/sxipio.c
> > > > @@ -249,7 +249,7 @@ sxipio_getcfg(int pin)
> > > >  
> > > > splx(s);
> > > >  
> > > > -   return data >> off & 7;
> > > > +   return (data >> off) & 0xf;
> > > >  }
> > > >  
> > > >  void
> > > > @@ -263,7 +263,7 @@ sxipio_setcfg(int pin, int mux)
> > > > bit = pin - (port << 5);
> > > > reg = SXIPIO_CFG(port, bit >> 3);
> > > > off = (bit & 7) << 2;
> > > > -   cmask = 7 << off;
> > > > +   cmask = 0xf << off;
> > > > mask = mux << off;
> > > >  
> > > > s = splhigh();
> > > > 
> > > 
> > > Hi,
> > > 
> > > i think you're wrong, "manuals" for both A10 are rather clear about 
> > > this.
> > > last bit of each cfg is reserved, code doesn't touch the last bit on 
> > > purpose.
> > > see A10 user manual rev1.2 page 288, or A20 user manual rev1.0 page 248 
> > > for
> > > example of one such cfg register(PA_CFG0).
> > > 
> > > -Artturi
> > > 
> > 
> > True that! I wonder if it would make sense to at least set the clear
> > mask to 0xf, so at least you don't write back whatever bit there
> > might be set or not set?
> > 
> 
> don't know, and don't even really care atm., just noticed today that
> according to man pages i'm not apparently author of any of sunxi drivers:P

It looks like rapha took the earliest copyright to be the author of
the driver.  How about the below diff or should we just remove the
AUTHORS section?

Index: a1xintc.4
===
RCS file: /cvs/src/share/man/man4/man4.armv7/a1xintc.4,v
retrieving revision 1.1
diff -u -p -r1.1 a1xintc.4
--- a1xintc.4   22 Sep 2014 14:02:38 -  1.1
+++ a1xintc.4   1 Feb 2016 22:53:02 -
@@ -36,4 +36,4 @@ device driver first appeared in
 The
 .Nm
 driver was written by
-.An Dale Rahn Aq Mt dr...@dalerahn.com .
+.An Artturi Alm .
Index: sxiccmu.4
===
RCS file: /cvs/src/share/man/man4/man4.armv7/sxiccmu.4,v
retrieving revision 1.1
diff -u -p -r1.1 sxiccmu.4
--- sxiccmu.4   22 Sep 2014 14:02:38 -  1.1
+++ sxiccmu.4   1 Feb 2016 22:55:02 -
@@ -36,4 +36,4 @@ device driver first appeared in
 The
 .Nm
 driver was written by
-.An Dale Rahn Aq Mt dr...@dalerahn.com .
+.An Artturi Alm .
Index: sxidog.4
===
RCS file: /cvs/src/share/man/man4/man4.armv7/sxidog.4,v
retrieving revision 1.1
diff -u -p -r1.1 sxidog.4
--- sxidog.422 Sep 2014 14:02:38 -  1.1
+++ sxidog.41 Feb 2016 22:56:14 -
@@ -36,4 +36,4 @@ device driver first appeared in
 The
 .Nm
 driver was written by
-.An Dale Rahn Aq Mt dr...@dalerahn.com .
+.An Artturi Alm .
Index: sxie.4
===
RCS file: /cvs/src/share/man/man4/man4.armv7/sxie.4,v
retrieving revision 1.1
diff -u -p -r1.1 sxie.4
--- sxie.4  22 Sep 2014 14:02:38 -  1.1
+++ sxie.4  1 Feb 2016 22:56:52 -
@@ -43,4 +43,4 @@ device driver first appeared in
 The
 .Nm
 driver was written by
-.An Patrick Wildt Aq Mt patr...@blueri.se .
+.An Artturi Alm .
Index: sxipio.4
===
RCS file: /cvs/src/share/man/man4/man4.armv7/sxipio.4,v
retrieving revision 1.1
diff -u -p -r1.1 sxipio.4
--- sxipio.422 Sep 2014 14:02:38 -  1.1
+++ sxipio.41 Feb 2016 22:59:11 -
@@ -46,4 +46,4 @@ driver first appeared in
 The
 .Nm
 driver was written by
-.An Miodrag Vallat .
+.An Artturi Alm .
Index: sxitimer.4
===
RCS file: /cvs/src/share/man/man4/man4.armv7/sxitimer.4,v
retrieving revision 1.1
diff -u -p -r1.1 sxitimer.4
--- sxitimer.4  22 Sep 2014 14:02:38 -  1.1
+++ sxitimer.4  1 Feb 2016 22:57:46 -
@@ -36,4 +36,4 @@ device driver first appeared in
 The
 .Nm
 driver was written by
-.An Dale Rahn Aq Mt dr...@dalerahn.com .
+.An Artturi Alm .



Re: sunxi: fix sxipio func mask

2016-02-01 Thread Artturi Alm
On Tue, Feb 02, 2016 at 10:01:45AM +1100, Jonathan Gray wrote:
> On Tue, Feb 02, 2016 at 12:24:02AM +0200, Artturi Alm wrote:
> > On Mon, Feb 01, 2016 at 10:14:38PM +0100, Patrick Wildt wrote:
> > > On Mon, Feb 01, 2016 at 10:51:40PM +0200, Artturi Alm wrote:
> > > > On Mon, Feb 01, 2016 at 09:06:35PM +0100, Patrick Wildt wrote:
> > > > > Hi,
> > > > > 
> > > > > in sxipio the mask is incorrect for get- and setcfg.
> > > > > 
> > > > > If bit is 1, off is (1 & 7) << 2, which is 4. That means each cfg is 4
> > > > > bits wide, so the mask is 0xf and not 0x7.  I cross-checked it with
> > > > > NetBSD and Linux.
> > > > > 
> > > > > As far as I know it does not fix any known issue for me, it's just
> > > > > something that caught my eye.
> > > > > 
> > > > > Patrick
> > > > > 
> > > > > diff --git sys/arch/armv7/sunxi/sxipio.c sys/arch/armv7/sunxi/sxipio.c
> > > > > index 9a49343..07a3c76 100644
> > > > > --- sys/arch/armv7/sunxi/sxipio.c
> > > > > +++ sys/arch/armv7/sunxi/sxipio.c
> > > > > @@ -249,7 +249,7 @@ sxipio_getcfg(int pin)
> > > > >  
> > > > >   splx(s);
> > > > >  
> > > > > - return data >> off & 7;
> > > > > + return (data >> off) & 0xf;
> > > > >  }
> > > > >  
> > > > >  void
> > > > > @@ -263,7 +263,7 @@ sxipio_setcfg(int pin, int mux)
> > > > >   bit = pin - (port << 5);
> > > > >   reg = SXIPIO_CFG(port, bit >> 3);
> > > > >   off = (bit & 7) << 2;
> > > > > - cmask = 7 << off;
> > > > > + cmask = 0xf << off;
> > > > >   mask = mux << off;
> > > > >  
> > > > >   s = splhigh();
> > > > > 
> > > > 
> > > > Hi,
> > > > 
> > > > i think you're wrong, "manuals" for both A10 are rather clear about 
> > > > this.
> > > > last bit of each cfg is reserved, code doesn't touch the last bit on 
> > > > purpose.
> > > > see A10 user manual rev1.2 page 288, or A20 user manual rev1.0 page 248 
> > > > for
> > > > example of one such cfg register(PA_CFG0).
> > > > 
> > > > -Artturi
> > > > 
> > > 
> > > True that! I wonder if it would make sense to at least set the clear
> > > mask to 0xf, so at least you don't write back whatever bit there
> > > might be set or not set?
> > > 
> > 
> > don't know, and don't even really care atm., just noticed today that
> > according to man pages i'm not apparently author of any of sunxi drivers:P
> 
> It looks like rapha took the earliest copyright to be the author of
> the driver.  How about the below diff or should we just remove the
> AUTHORS section?
> 

likely so, i left those copyrights of previously (likely) more than once
copy'd drivers as they were, and ofc in most cases used the existing
code using necessary MI interfaces.
i would have sent the diff below if it did matter to me, personally i feel
that AUTHORS section provides no value given copyright in actual sources.

-Artturi

> Index: a1xintc.4
> ===
> RCS file: /cvs/src/share/man/man4/man4.armv7/a1xintc.4,v
> retrieving revision 1.1
> diff -u -p -r1.1 a1xintc.4
> --- a1xintc.4 22 Sep 2014 14:02:38 -  1.1
> +++ a1xintc.4 1 Feb 2016 22:53:02 -
> @@ -36,4 +36,4 @@ device driver first appeared in
>  The
>  .Nm
>  driver was written by
> -.An Dale Rahn Aq Mt dr...@dalerahn.com .
> +.An Artturi Alm .
> Index: sxiccmu.4
> ===
> RCS file: /cvs/src/share/man/man4/man4.armv7/sxiccmu.4,v
> retrieving revision 1.1
> diff -u -p -r1.1 sxiccmu.4
> --- sxiccmu.4 22 Sep 2014 14:02:38 -  1.1
> +++ sxiccmu.4 1 Feb 2016 22:55:02 -
> @@ -36,4 +36,4 @@ device driver first appeared in
>  The
>  .Nm
>  driver was written by
> -.An Dale Rahn Aq Mt dr...@dalerahn.com .
> +.An Artturi Alm .
> Index: sxidog.4
> ===
> RCS file: /cvs/src/share/man/man4/man4.armv7/sxidog.4,v
> retrieving revision 1.1
> diff -u -p -r1.1 sxidog.4
> --- sxidog.4  22 Sep 2014 14:02:38 -  1.1
> +++ sxidog.4  1 Feb 2016 22:56:14 -
> @@ -36,4 +36,4 @@ device driver first appeared in
>  The
>  .Nm
>  driver was written by
> -.An Dale Rahn Aq Mt dr...@dalerahn.com .
> +.An Artturi Alm .
> Index: sxie.4
> ===
> RCS file: /cvs/src/share/man/man4/man4.armv7/sxie.4,v
> retrieving revision 1.1
> diff -u -p -r1.1 sxie.4
> --- sxie.422 Sep 2014 14:02:38 -  1.1
> +++ sxie.41 Feb 2016 22:56:52 -
> @@ -43,4 +43,4 @@ device driver first appeared in
>  The
>  .Nm
>  driver was written by
> -.An Patrick Wildt Aq Mt patr...@blueri.se .
> +.An Artturi Alm .
> Index: sxipio.4
> ===
> RCS file: /cvs/src/share/man/man4/man4.armv7/sxipio.4,v
> retrieving revision 1.1
> diff -u -p -r1.1 sxipio.4
> --- sxipio.4  22 Sep 2014 14:02:38 -  1.1
> +++ sxipio.4  1 Feb 2016 22:59:11 -
> @@ -46,4 +46,4 @@ driver first appeared in
>  The
>  .Nm
>  driver was written by

Re: sunxi: don't use sxitimer on the sun7i/A20

2016-02-01 Thread Jonathan Gray
On Mon, Feb 01, 2016 at 02:55:52AM +0200, Artturi Alm wrote:
> On Sun, Jan 31, 2016 at 10:45:42PM +1100, Jonathan Gray wrote:
> > On Sun, Jan 31, 2016 at 10:12:05AM +0200, Artturi Alm wrote:
> > > On Sun, Jan 31, 2016 at 01:14:35AM +0100, Patrick Wildt wrote:
> > > > Hi,
> > > > 
> > > > one of the reasons Allwinner A20/sun7i-based boards, like the
> > > > Cubieboard 2 or Banana Pi, don't boot is that the sxitimer does
> > > > not work for us.  We are getting no hardclock ticks and so the
> > > > system can't work.
> > > > 
> > > > There's a simple fix for that.  We can just not use the sxitimer
> > > > and instead use the ARM architected timer (agtimer) that is
> > > > supposed to be a generic implementation for all new cores and
> > > > already attaches anyway.  The sxitimer attachment currently
> > > > overrides the agtimer.  Removing sxitimer thus allows agtimer
> > > > to actually do its work.
> > > > 
> > > > Currently sxirtc uncondtionally ties into sxitimer.  To make
> > > > this work, just make sxirtc map its own page instead of relying
> > > > on the existence of a mapping created by sxitimer.
> > > > 
> > > > The address/size used for the sxirtc is from a device tree
> > > > source.
> > > > 
> > > > Patrick
> > > > 
> > > 
> > > Hi,
> > > 
> > > nothing i would change about your diff, given now there's agtimer,
> > > but it doesn't really seem to even try fixing rtc on A20, and leaves
> > > ugly glue into sxitimer written just for A20, which imho should also
> > > get cleaned up.
> > > 
> > > -Artturi
> > 
> > There seem to be at least two diffs here, the different rtc handling
> > for a20 should be split out, store sxirtc_a20 in the softc and fix
> > the test from
> > if (BOARD_ID_SUN7I_A20)
> > to
> > if (board_id == BOARD_ID_SUN7I_A20)
> > 
> 
> Yes, it was quick try during my morning coffee, i'm sorry to have wasted
> your time with the previous obviously wrong diff.
> 
> sxitimer a20 support glue cleanup diff inline.
> 
> -Artturi

Thanks, both diffs committed.  Any chance you could create another to
move the sxitimer_* globals into the softc?



Re: I have a program I wish to submit for the base

2016-02-01 Thread Luke Small
1. You can pick a mirror relatively trivially, but since I've run the
program, the fastest one isn't the one I chose manually. Also, it can
choose multiple mirrors at once, so presumably if there is a failure, it
will choose the next mirror(s) that it wrote down in pkg.conf

2. You are saying that the ftp protocol can be implemented trivially? You
are ridiculous sir.

3. How do you suggest I filter out obviously bad choices. Add on a perl
geolocation package that isn't available in a base install. How about I
just ftp download a smaller file to discover the latency.

4. How doesn't it meet standards. I wrote it according to the style man
page as far as I can tell. And I ran it through indent. Even though I think
kernel normal form is less readable.

I think that there is some unwritten policy that nobody can get something
like this into the system. Why on earth hasn't this happened yet?
On Feb 1, 2016 10:48, "Dmitrij D. Czarkoff"  wrote:

> Jorge Castillo said:
> > Why not make it a port?
>
> Making port for figuring out PKGPATH doesn't sound right.
>
> See, there are four problems with the program:
>
> 1.  It is not good enough in doing its job.  Which is funny, because
> picking right mirror is trivially done without any program.
> 2.  It uses external tools for tasks that could be trivially implemented
> in C.
> 3.  It doesn't filter out obviously bad choices, eg. users in Europe
> will test mirrors in North America.
> 4.  It doesn't meet OpenBSD's standards for code in base.
>
> Problems #2, #3 and #4 can be fixed, but problem #1 makes this
> discussion completely pointless.  Provided that all OpenBSD developers
> who cared to participate in this discussion pointed out this issue, I'd
> suggest to stop wasting time and bandwidth right here.
>
> Luke, if you disagree with my assessment, please publish your program on
> github and convince tech media to mention it.  And move to next thing.
> Thank you in advance.
>
> --
> Dmitrij D. Czarkoff
>


Re: Can I accelerate my magnet HDD using a SSD in any way?? E.g. softraid patch/ARC, dedicated hardware e.g. Intel RCS25ZB040LX="Nytro MegaRAID", anything

2016-02-01 Thread Janne Johansson
2016-01-31 9:16 GMT+01:00 Tinker :

> This could be made in software with benefit, as a Softraid patch.
> So the frequently accessed stuff ends up cached on the SSD for faster read
> speed.
> There is some hardware solution, e.g. Intel made the
> http://ark.intel.com/products/70029/Intel-RAID-SSD-Cache-Controller-RCS25ZB040LX
> using the "Nytro MegaRAID" chip.
> Also in the past there was a "Adaptec MaxIQ". Those are the only two "Raid
> controller cache" hardware solutions I am aware of, do you know any more?
>
>
Intel Z68 motherboards also have this in hardware. A bit tiresome to set up
for bootdrives (since the disk type changes from normal SATA to raid)
but should be transparent to the OS after it is set up.


Re: ldapd: add -r option to specify datadir path

2016-02-01 Thread Sebastien Marie
On Sun, Jan 31, 2016 at 09:39:52AM +0100, Landry Breuil wrote:
> Hi,
> 
> i'm tinkering with ldapd and writing regress tests for it, and to
> allow running independent instances (with separate port/control
> socket/etc) i needed to add the possibility to specify an alternative
> datadir, which was so far #defined in the code.
> Patch is pretty simple and works fine, i'm open to suggestions of course
> on a better wording for the manpage and option choose (i went for -r..)
> okays welcome too !
> 

the diff looks good and it would permit to make regress tests, so OK semarie@ :)

> 
> Index: ldapd.8
> ===
> RCS file: /cvs/src/usr.sbin/ldapd/ldapd.8,v
> retrieving revision 1.12
> diff -u -r1.12 ldapd.8
> --- ldapd.8   11 Aug 2014 08:21:55 -  1.12
> +++ ldapd.8   23 Jan 2016 10:11:48 -
> @@ -57,6 +57,11 @@
>  .Ar file
>  as the configuration file, instead of the default
>  .Pa /etc/ldapd.conf .
> +.It Fl r Ar directory
> +Store and read database files in
> +.Ar directory
> +, instead of the default
> +.Pa /var/db/ldap .
>  .It Fl n
>  Configtest mode.
>  Only check the configuration file for validity.
> Index: ldapd.c
> ===
> RCS file: /cvs/src/usr.sbin/ldapd/ldapd.c,v
> retrieving revision 1.16
> diff -u -r1.16 ldapd.c
> --- ldapd.c   17 Jan 2016 08:13:34 -  1.16
> +++ ldapd.c   23 Jan 2016 10:11:48 -
> @@ -50,6 +50,7 @@
>  
>  struct ldapd_statsstats;
>  pid_t ldape_pid;
> +char *datadir;
>  
>  void
>  usage(void)
> @@ -57,7 +58,7 @@
>   extern char *__progname;
>  
>   fprintf(stderr, "usage: %s [-dnv] [-D macro=value] "
> - "[-f file] [-s file]\n", __progname);
> + "[-f file] [-r directory] [-s file]\n", __progname);
>   exit(1);
>  }
>  
> @@ -117,9 +118,10 @@
>   struct event ev_sigchld;
>   struct event ev_sighup;
>  
> + datadir = DATADIR;
>   log_init(1);/* log to stderr until daemonized */
>  
> - while ((c = getopt(argc, argv, "dhvD:f:ns:")) != -1) {
> + while ((c = getopt(argc, argv, "dhvD:f:nr:s:")) != -1) {
>   switch (c) {
>   case 'd':
>   debug = 1;
> @@ -139,6 +141,9 @@
>   case 'n':
>   configtest = 1;
>   break;
> + case 'r':
> + datadir = optarg;
> + break;
>   case 's':
>   csockpath = optarg;
>   break;
> @@ -366,7 +371,7 @@
>   /* make sure path is null-terminated */
>   oreq->path[PATH_MAX] = '\0';
>  
> - if (strncmp(oreq->path, DATADIR, strlen(DATADIR)) != 0) {
> + if (strncmp(oreq->path, datadir, strlen(datadir)) != 0) {
>   log_warnx("refusing to open file %s", oreq->path);
>   fatal("ldape sent invalid open request");
>   }
> Index: namespace.c
> ===
> RCS file: /cvs/src/usr.sbin/ldapd/namespace.c,v
> retrieving revision 1.14
> diff -u -r1.14 namespace.c
> --- namespace.c   24 Dec 2015 17:47:57 -  1.14
> +++ namespace.c   23 Jan 2016 10:11:48 -
> @@ -38,6 +38,7 @@
>  static intnamespace_set_fd(struct namespace *ns,
>   struct btree **bt, int fd, unsigned int flags);
>  
> +extern char  *datadir;
>  int
>  namespace_begin_txn(struct namespace *ns, struct btree_txn **data_txn,
>  struct btree_txn **indx_txn, int rdonly)
> @@ -115,7 +116,7 @@
>   if (ns->sync == 0)
>   db_flags |= BT_NOSYNC;
>  
> - if (asprintf(>data_path, "%s/%s_data.db", DATADIR, ns->suffix) < 0)
> + if (asprintf(>data_path, "%s/%s_data.db", datadir, ns->suffix) < 0)
>   return -1;
>   log_info("opening namespace %s", ns->suffix);
>   ns->data_db = btree_open(ns->data_path, db_flags | BT_REVERSEKEY, 0644);
> @@ -124,7 +125,7 @@
>  
>   btree_set_cache_size(ns->data_db, ns->cache_size);
>  
> - if (asprintf(>indx_path, "%s/%s_indx.db", DATADIR, ns->suffix) < 0)
> + if (asprintf(>indx_path, "%s/%s_indx.db", datadir, ns->suffix) < 0)
>   return -1;
>   ns->indx_db = btree_open(ns->indx_path, db_flags, 0644);
>   if (ns->indx_db == NULL)
> 
> 

-- 
Sebastien Marie



Re: Karel, some followup Q:s on your RAID1C patch

2016-02-01 Thread Janne Johansson
2016-01-31 9:24 GMT+01:00 Tinker :

> Q1:
>
> My most important question to you is, the DATA that you CHECKSUM, do you
> include the SECTOR NUMBER (or other disk location info) of that data into
> your checksum function's inputs, so if the underlying storage's storage
> mapping table breaks down or by other reason disk WRITE:s go to the WRONG
> place, then when READ later on, those READS will FAIL?
>


Whenever any underlying storage does migrations, it would never change the
OS view of the sector number, all filesystems (raid or not) would break if
that happened.

-- 
May the most significant bit of your life be positive.


Re: Karel, some followup Q:s on your RAID1C patch

2016-02-01 Thread Janne Johansson
I did not oppose adding the sector number, just the "idea" that internal
relocations would make this number change.
If it did, then everything would break for all filesystems, so that is
obviously not how it is done.


2016-02-01 11:11 GMT+01:00 Tinker :

> On 2016-02-01 16:29, Janne Johansson wrote:
>
>> 2016-01-31 9:24 GMT+01:00 Tinker :
>>
>> Q1:
>>>
>>> My most important question to you is, the DATA that you CHECKSUM, do you
>>> include the SECTOR NUMBER (or other disk location info) of that data into
>>> your checksum function's inputs, so if the underlying storage's storage
>>> mapping table breaks down or by other reason disk WRITE:s go to the WRONG
>>> place, then when READ later on, those READS will FAIL?
>>>
>>>
>>
>> Whenever any underlying storage does migrations, it would never change the
>> OS view of the sector number, all filesystems (raid or not) would break if
>> that happened.
>>
>
> Janne (and Karel),
>
> The reason I suggested the location info e.g. sector number to be included
> in the checksum calculation's input data, is that it's a real risk that a
> disk's logical-sector-to-physical-sector-mapping table breaks down, either
> because of physical failure, or because of firmware errors in disk
> controller or disk, or because of OS bugs, memory bugs, driver bugs, you
> name it.
>
> While I agree that within RAID1C the probability ridiculously small, that
> such a failure would happen so that a certain sector X's location would be
> corrupted, *and* that its checksum in the checksums zone on the disk would
> be corrupted in a way symmetric with the first corruption so that the
> checksum checks not would catch the problem also, then still on a level of
> (mathemathical/system) symmetry it does make a sense that the checksum
> calculation uses the data location as input also.
>
> ZFS does this to guarantee that the data read is the data that really
> belongs there.
>
> And I guess we're talking about in the range 50-100 extra CPU cycles per
> sector access to deliver this, and no extra storage need, so my spontaneous
> feel about this is that it probably could be implemented on a "why-not"
> basis -
>
> What do you say?
>
> Tinker
>
>


-- 
May the most significant bit of your life be positive.


Re: Karel, some followup Q:s on your RAID1C patch

2016-02-01 Thread Tinker

On 2016-02-01 16:29, Janne Johansson wrote:

2016-01-31 9:24 GMT+01:00 Tinker :


Q1:

My most important question to you is, the DATA that you CHECKSUM, do 
you
include the SECTOR NUMBER (or other disk location info) of that data 
into
your checksum function's inputs, so if the underlying storage's 
storage
mapping table breaks down or by other reason disk WRITE:s go to the 
WRONG

place, then when READ later on, those READS will FAIL?




Whenever any underlying storage does migrations, it would never change 
the
OS view of the sector number, all filesystems (raid or not) would break 
if

that happened.


Janne (and Karel),

The reason I suggested the location info e.g. sector number to be 
included in the checksum calculation's input data, is that it's a real 
risk that a disk's logical-sector-to-physical-sector-mapping table 
breaks down, either because of physical failure, or because of firmware 
errors in disk controller or disk, or because of OS bugs, memory bugs, 
driver bugs, you name it.


While I agree that within RAID1C the probability ridiculously small, 
that such a failure would happen so that a certain sector X's location 
would be corrupted, *and* that its checksum in the checksums zone on the 
disk would be corrupted in a way symmetric with the first corruption so 
that the checksum checks not would catch the problem also, then still on 
a level of (mathemathical/system) symmetry it does make a sense that the 
checksum calculation uses the data location as input also.


ZFS does this to guarantee that the data read is the data that really 
belongs there.


And I guess we're talking about in the range 50-100 extra CPU cycles per 
sector access to deliver this, and no extra storage need, so my 
spontaneous feel about this is that it probably could be implemented on 
a "why-not" basis -


What do you say?

Tinker



Re: can't run multiple instances of httpd, flags not visible in processes

2016-02-01 Thread Stuart Henderson
moved from misc.

On 2016-01-28, Antoine Jacoutot  wrote:
>> Well, we "tradionally" had setproctitle("[priv]") in the parent.  I
>> changed the tradition to setproctitle("parent").
>> 
>> I have no objections with changing this in the parent (but keeping the
>> setproctitles in the children) to either the default (all command line
>> flags) or to something like setproctitle("parent, %s", conffile).
>> Command line flags suck and I don't think that -d or -v would be
>> helpful in the output, so I prefer the latter.
>
> "-v" is helpful at least for rc.d which needs to match the full args list by 
> default
>
>> All rc scripts would have to be adjusted by somebody with better rc-fu.
>
> Actually if things are properly done, the non default pexp line in the rc.d 
> scripts should just be removed and that's it.
>

Here it is for the majority of base daemons. I've left ypldap for now,
the rc script matches "ldap client" not "parent". radiusd already leaves
the parent process title as-is (the setproctitle("[main]") are separate
processes).

OK?


Index: etc/rc.d/eigrpd
===
RCS file: /cvs/src/etc/rc.d/eigrpd,v
retrieving revision 1.2
diff -u -p -r1.2 eigrpd
--- etc/rc.d/eigrpd 21 Oct 2015 11:28:02 -  1.2
+++ etc/rc.d/eigrpd 1 Feb 2016 13:51:58 -
@@ -6,6 +6,4 @@ daemon="/usr/sbin/eigrpd"
 
 . /etc/rc.d/rc.subr
 
-pexp="eigrpd: parent.*"
-
 rc_cmd $1
Index: etc/rc.d/httpd
===
RCS file: /cvs/src/etc/rc.d/httpd,v
retrieving revision 1.4
diff -u -p -r1.4 httpd
--- etc/rc.d/httpd  19 Dec 2015 13:45:12 -  1.4
+++ etc/rc.d/httpd  1 Feb 2016 13:51:58 -
@@ -6,8 +6,6 @@ daemon="/usr/sbin/httpd"
 
 . /etc/rc.d/rc.subr
 
-pexp="httpd: parent.*"
-
 # child will not return a config parsing error to the parent
 rc_pre() {
${daemon} -n ${daemon_flags}
Index: etc/rc.d/ldpd
===
RCS file: /cvs/src/etc/rc.d/ldpd,v
retrieving revision 1.1
diff -u -p -r1.1 ldpd
--- etc/rc.d/ldpd   6 Jul 2011 18:55:36 -   1.1
+++ etc/rc.d/ldpd   1 Feb 2016 13:51:58 -
@@ -6,6 +6,4 @@ daemon="/usr/sbin/ldpd"
 
 . /etc/rc.d/rc.subr
 
-pexp="ldpd: parent.*"
-
 rc_cmd $1
Index: etc/rc.d/npppd
===
RCS file: /cvs/src/etc/rc.d/npppd,v
retrieving revision 1.1
diff -u -p -r1.1 npppd
--- etc/rc.d/npppd  20 Sep 2012 12:51:43 -  1.1
+++ etc/rc.d/npppd  1 Feb 2016 13:51:58 -
@@ -6,6 +6,4 @@ daemon="/usr/sbin/npppd"
 
 . /etc/rc.d/rc.subr
 
-pexp="npppd: main"
-
 rc_cmd $1
Index: etc/rc.d/ntpd
===
RCS file: /cvs/src/etc/rc.d/ntpd,v
retrieving revision 1.2
diff -u -p -r1.2 ntpd
--- etc/rc.d/ntpd   14 Sep 2011 02:36:09 -  1.2
+++ etc/rc.d/ntpd   1 Feb 2016 13:51:58 -
@@ -6,7 +6,6 @@ daemon="/usr/sbin/ntpd"
 
 . /etc/rc.d/rc.subr
 
-pexp="ntpd: \[priv\]"
 rc_reload=NO
 
 rc_cmd $1
Index: etc/rc.d/ospf6d
===
RCS file: /cvs/src/etc/rc.d/ospf6d,v
retrieving revision 1.1
diff -u -p -r1.1 ospf6d
--- etc/rc.d/ospf6d 17 Jul 2011 00:25:58 -  1.1
+++ etc/rc.d/ospf6d 1 Feb 2016 13:51:58 -
@@ -6,6 +6,4 @@ daemon="/usr/sbin/ospf6d"
 
 . /etc/rc.d/rc.subr
 
-pexp="ospf6d: parent.*"
-
 rc_cmd $1
Index: etc/rc.d/ospfd
===
RCS file: /cvs/src/etc/rc.d/ospfd,v
retrieving revision 1.1
diff -u -p -r1.1 ospfd
--- etc/rc.d/ospfd  8 Jul 2011 22:20:07 -   1.1
+++ etc/rc.d/ospfd  1 Feb 2016 13:51:58 -
@@ -6,6 +6,4 @@ daemon="/usr/sbin/ospfd"
 
 . /etc/rc.d/rc.subr
 
-pexp="ospfd: parent.*"
-
 rc_cmd $1
Index: etc/rc.d/relayd
===
RCS file: /cvs/src/etc/rc.d/relayd,v
retrieving revision 1.2
diff -u -p -r1.2 relayd
--- etc/rc.d/relayd 19 Dec 2015 13:45:12 -  1.2
+++ etc/rc.d/relayd 1 Feb 2016 13:51:58 -
@@ -6,8 +6,6 @@ daemon="/usr/sbin/relayd"
 
 . /etc/rc.d/rc.subr
 
-pexp="relayd: parent.*"
-
 # child will not return a config parsing error to the parent
 rc_pre() {
${daemon} -n ${daemon_flags}
Index: etc/rc.d/ripd
===
RCS file: /cvs/src/etc/rc.d/ripd,v
retrieving revision 1.1
diff -u -p -r1.1 ripd
--- etc/rc.d/ripd   6 Jul 2011 18:55:36 -   1.1
+++ etc/rc.d/ripd   1 Feb 2016 13:51:58 -
@@ -6,6 +6,4 @@ daemon="/usr/sbin/ripd"
 
 . /etc/rc.d/rc.subr
 
-pexp="ripd: parent.*"
-
 rc_cmd $1
Index: etc/rc.d/snmpd
===
RCS file: /cvs/src/etc/rc.d/snmpd,v
retrieving revision 1.2
diff -u -p -r1.2 snmpd
--- etc/rc.d/snmpd  25 Aug 2014 12:08:55 -  1.2

Re: fix armv7 long descriptor second level bits

2016-02-01 Thread Jonathan Gray
On Sun, Jan 31, 2016 at 06:55:57PM +0100, Patrick Wildt wrote:
> On Sun, Jan 31, 2016 at 06:19:59PM +1100, Jonathan Gray wrote:
> > The AP bits are the same place as in the small descriptor second level
> > format.
> > 
> > Expanded version of a diff from Patrick.
> 
> Looks good to me, works for me.

Committed with the mask fixed to have L2_V7_L_XN not L2_V7_S_XN,
though L2_L_PROT_MASK isn't used at the moment.



Re: can't run multiple instances of httpd, flags not visible in processes

2016-02-01 Thread Joerg Jung

> On 01 Feb 2016, at 14:53, Stuart Henderson  wrote:
> 
> moved from misc.
> 
> On 2016-01-28, Antoine Jacoutot  wrote:
>>> Well, we "tradionally" had setproctitle("[priv]") in the parent.  I
>>> changed the tradition to setproctitle("parent").
>>> 
>>> I have no objections with changing this in the parent (but keeping the
>>> setproctitles in the children) to either the default (all command line
>>> flags) or to something like setproctitle("parent, %s", conffile).
>>> Command line flags suck and I don't think that -d or -v would be
>>> helpful in the output, so I prefer the latter.
>> 
>> "-v" is helpful at least for rc.d which needs to match the full args list by 
>> default
>> 
>>> All rc scripts would have to be adjusted by somebody with better rc-fu.
>> 
>> Actually if things are properly done, the non default pexp line in the rc.d 
>> scripts should just be removed and that's it.
>> 
> 
> Here it is for the majority of base daemons. I've left ypldap for now,
> the rc script matches "ldap client" not "parent". radiusd already leaves
> the parent process title as-is (the setproctitle("[main]") are separate
> processes).
> 
> OK?

ok jung@

What about smtpd, should be similar, no?


> Index: etc/rc.d/eigrpd
> ===
> RCS file: /cvs/src/etc/rc.d/eigrpd,v
> retrieving revision 1.2
> diff -u -p -r1.2 eigrpd
> --- etc/rc.d/eigrpd   21 Oct 2015 11:28:02 -  1.2
> +++ etc/rc.d/eigrpd   1 Feb 2016 13:51:58 -
> @@ -6,6 +6,4 @@ daemon="/usr/sbin/eigrpd"
> 
> . /etc/rc.d/rc.subr
> 
> -pexp="eigrpd: parent.*"
> -
> rc_cmd $1
> Index: etc/rc.d/httpd
> ===
> RCS file: /cvs/src/etc/rc.d/httpd,v
> retrieving revision 1.4
> diff -u -p -r1.4 httpd
> --- etc/rc.d/httpd19 Dec 2015 13:45:12 -  1.4
> +++ etc/rc.d/httpd1 Feb 2016 13:51:58 -
> @@ -6,8 +6,6 @@ daemon="/usr/sbin/httpd"
> 
> . /etc/rc.d/rc.subr
> 
> -pexp="httpd: parent.*"
> -
> # child will not return a config parsing error to the parent
> rc_pre() {
>   ${daemon} -n ${daemon_flags}
> Index: etc/rc.d/ldpd
> ===
> RCS file: /cvs/src/etc/rc.d/ldpd,v
> retrieving revision 1.1
> diff -u -p -r1.1 ldpd
> --- etc/rc.d/ldpd 6 Jul 2011 18:55:36 -   1.1
> +++ etc/rc.d/ldpd 1 Feb 2016 13:51:58 -
> @@ -6,6 +6,4 @@ daemon="/usr/sbin/ldpd"
> 
> . /etc/rc.d/rc.subr
> 
> -pexp="ldpd: parent.*"
> -
> rc_cmd $1
> Index: etc/rc.d/npppd
> ===
> RCS file: /cvs/src/etc/rc.d/npppd,v
> retrieving revision 1.1
> diff -u -p -r1.1 npppd
> --- etc/rc.d/npppd20 Sep 2012 12:51:43 -  1.1
> +++ etc/rc.d/npppd1 Feb 2016 13:51:58 -
> @@ -6,6 +6,4 @@ daemon="/usr/sbin/npppd"
> 
> . /etc/rc.d/rc.subr
> 
> -pexp="npppd: main"
> -
> rc_cmd $1
> Index: etc/rc.d/ntpd
> ===
> RCS file: /cvs/src/etc/rc.d/ntpd,v
> retrieving revision 1.2
> diff -u -p -r1.2 ntpd
> --- etc/rc.d/ntpd 14 Sep 2011 02:36:09 -  1.2
> +++ etc/rc.d/ntpd 1 Feb 2016 13:51:58 -
> @@ -6,7 +6,6 @@ daemon="/usr/sbin/ntpd"
> 
> . /etc/rc.d/rc.subr
> 
> -pexp="ntpd: \[priv\]"
> rc_reload=NO
> 
> rc_cmd $1
> Index: etc/rc.d/ospf6d
> ===
> RCS file: /cvs/src/etc/rc.d/ospf6d,v
> retrieving revision 1.1
> diff -u -p -r1.1 ospf6d
> --- etc/rc.d/ospf6d   17 Jul 2011 00:25:58 -  1.1
> +++ etc/rc.d/ospf6d   1 Feb 2016 13:51:58 -
> @@ -6,6 +6,4 @@ daemon="/usr/sbin/ospf6d"
> 
> . /etc/rc.d/rc.subr
> 
> -pexp="ospf6d: parent.*"
> -
> rc_cmd $1
> Index: etc/rc.d/ospfd
> ===
> RCS file: /cvs/src/etc/rc.d/ospfd,v
> retrieving revision 1.1
> diff -u -p -r1.1 ospfd
> --- etc/rc.d/ospfd8 Jul 2011 22:20:07 -   1.1
> +++ etc/rc.d/ospfd1 Feb 2016 13:51:58 -
> @@ -6,6 +6,4 @@ daemon="/usr/sbin/ospfd"
> 
> . /etc/rc.d/rc.subr
> 
> -pexp="ospfd: parent.*"
> -
> rc_cmd $1
> Index: etc/rc.d/relayd
> ===
> RCS file: /cvs/src/etc/rc.d/relayd,v
> retrieving revision 1.2
> diff -u -p -r1.2 relayd
> --- etc/rc.d/relayd   19 Dec 2015 13:45:12 -  1.2
> +++ etc/rc.d/relayd   1 Feb 2016 13:51:58 -
> @@ -6,8 +6,6 @@ daemon="/usr/sbin/relayd"
> 
> . /etc/rc.d/rc.subr
> 
> -pexp="relayd: parent.*"
> -
> # child will not return a config parsing error to the parent
> rc_pre() {
>   ${daemon} -n ${daemon_flags}
> Index: etc/rc.d/ripd
> ===
> RCS file: /cvs/src/etc/rc.d/ripd,v
> retrieving revision 1.1
> diff -u -p -r1.1 ripd
> --- etc/rc.d/ripd 6 Jul 2011 18:55:36 -   1.1
> +++ etc/rc.d/ripd 1 Feb 2016 

Re: Some df(1) cleanup

2016-02-01 Thread Theo Buehler
On Mon, Feb 01, 2016 at 05:41:25PM +0100, Theo Buehler wrote:
> On Mon, Feb 01, 2016 at 05:17:03PM +0100, Michal Mazurek wrote:
> > Meaningful error messages:
> >
> > mntbuf = calloc(argc, sizeof(struct statfs));
> > if (mntbuf == NULL)
> > -   err(1, NULL);
> > +   err(1, "calloc");
> 
> I disagree with the changes in this patch.  If either malloc or calloc
> fails it will typically set errno to ENOMEM, so you'll
> 
> df: Cannot allocate memory
> 
> I don't think adding the information that it was malloc or calloc that
> failed is helpful at all.

Well, to be fair, it's done this way in the malloc manual, but still I'm
not in favor of changing this.

The header cleanup is ok tb@ if anyone wants to commit that.

I can't judge the correctness of the change of the comment.  There never
was a fsmask variable in df.c since it was imported.



Re: Some df(1) cleanup

2016-02-01 Thread Theo Buehler
On Mon, Feb 01, 2016 at 05:17:03PM +0100, Michal Mazurek wrote:
> Meaningful error messages:
>
>   mntbuf = calloc(argc, sizeof(struct statfs));
>   if (mntbuf == NULL)
> - err(1, NULL);
> + err(1, "calloc");

I disagree with the changes in this patch.  If either malloc or calloc
fails it will typically set errno to ENOMEM, so you'll

df: Cannot allocate memory

I don't think adding the information that it was malloc or calloc that
failed is helpful at all.

I can only speak for myself but I'd appreciate if you would send
unrelated patches in separate mails.



Re: Karel, some followup Q:s on your RAID1C patch

2016-02-01 Thread Tinker
Since these are not emails with patches, let's not disturb tech@ but 
have this thread moved to misc@ , thanks.


On 2016-02-01 18:40, Janne Johansson wrote:
I did not oppose adding the sector number, just the "idea" that 
internal

relocations would make this number change.
If it did, then everything would break for all filesystems, so that is
obviously not how it is done.


2016-02-01 11:11 GMT+01:00 Tinker :


On 2016-02-01 16:29, Janne Johansson wrote:


2016-01-31 9:24 GMT+01:00 Tinker :

Q1:


My most important question to you is, the DATA that you CHECKSUM, do 
you
include the SECTOR NUMBER (or other disk location info) of that data 
into
your checksum function's inputs, so if the underlying storage's 
storage
mapping table breaks down or by other reason disk WRITE:s go to the 
WRONG

place, then when READ later on, those READS will FAIL?




Whenever any underlying storage does migrations, it would never 
change the
OS view of the sector number, all filesystems (raid or not) would 
break if

that happened.



Janne (and Karel),

The reason I suggested the location info e.g. sector number to be 
included
in the checksum calculation's input data, is that it's a real risk 
that a
disk's logical-sector-to-physical-sector-mapping table breaks down, 
either

because of physical failure, or because of firmware errors in disk
controller or disk, or because of OS bugs, memory bugs, driver bugs, 
you

name it.

While I agree that within RAID1C the probability ridiculously small, 
that
such a failure would happen so that a certain sector X's location 
would be
corrupted, *and* that its checksum in the checksums zone on the disk 
would

be corrupted in a way symmetric with the first corruption so that the
checksum checks not would catch the problem also, then still on a 
level of

(mathemathical/system) symmetry it does make a sense that the checksum
calculation uses the data location as input also.

ZFS does this to guarantee that the data read is the data that really
belongs there.

And I guess we're talking about in the range 50-100 extra CPU cycles 
per
sector access to deliver this, and no extra storage need, so my 
spontaneous
feel about this is that it probably could be implemented on a 
"why-not"

basis -

What do you say?

Tinker






Re: I have a program I wish to submit for the base

2016-02-01 Thread Dmitrij D. Czarkoff
Jorge Castillo said:
> Why not make it a port? 

Making port for figuring out PKGPATH doesn't sound right.

See, there are four problems with the program:

1.  It is not good enough in doing its job.  Which is funny, because
picking right mirror is trivially done without any program.
2.  It uses external tools for tasks that could be trivially implemented
in C.
3.  It doesn't filter out obviously bad choices, eg. users in Europe
will test mirrors in North America.
4.  It doesn't meet OpenBSD's standards for code in base.

Problems #2, #3 and #4 can be fixed, but problem #1 makes this
discussion completely pointless.  Provided that all OpenBSD developers
who cared to participate in this discussion pointed out this issue, I'd
suggest to stop wasting time and bandwidth right here.

Luke, if you disagree with my assessment, please publish your program on
github and convince tech media to mention it.  And move to next thing.
Thank you in advance.

-- 
Dmitrij D. Czarkoff



sync dhcrelay's packet processing with dhcpd's.

2016-02-01 Thread Stuart Henderson
Not sure if I sent this before, but I found it sitting in a tree.
dhcrelay missed out on some of the changes made to dhcpd/dhclient's
packet.c. OK to sync them up? After this set of patches, the only
difference from dhcpd's is the intentional ipsec-related one.

OK?


"Remove unused (a.k.a. always passed NULL) parameter 'data' from
decode_udp_ip_header() and the useless check of it. Part of original
diff from pelikan about udp length errors."

dhcpd/bpf.c:1.8->1.9
dhcpd/dhcpd.h:1.45->1.46
dhcpd/packet.c:1.4->1.5

diff --git bpf.c bpf.c
index fad2e0a..298d3ec 100644
--- bpf.c
+++ bpf.c
@@ -377,7 +377,7 @@ receive_packet(struct interface_info *interface, unsigned 
char *buf,
 
/* Decode the IP and UDP headers... */
offset = decode_udp_ip_header(interface, interface->rbuf,
-   interface->rbuf_offset, from, NULL, hdr.bh_caplen);
+   interface->rbuf_offset, from, hdr.bh_caplen);
 
/* If the IP or UDP checksum was bad, skip the packet... */
if (offset < 0) {
diff --git dhcpd.h dhcpd.h
index c1d6917..b80e984 100644
--- dhcpd.h
+++ dhcpd.h
@@ -162,7 +162,7 @@ void remove_protocol(struct protocol *);
 void assemble_hw_header(struct interface_info *, unsigned char *,
 int *, struct hardware *);
 void assemble_udp_ip_header(struct interface_info *, unsigned char *,
-int *, u_int32_t, u_int32_t, unsigned int, unsigned char *, int);
+int *, u_int32_t, u_int32_t, unsigned int, int);
 ssize_t decode_hw_header(struct interface_info *, unsigned char *,
 int, struct hardware *);
 ssize_t decode_udp_ip_header(struct interface_info *, unsigned char *,
diff --git packet.c packet.c
index 6352f0c..c0e7432 100644
--- packet.c
+++ packet.c
@@ -178,10 +178,11 @@ decode_hw_header(struct interface_info *interface, 
unsigned char *buf,
 
 ssize_t
 decode_udp_ip_header(struct interface_info *interface, unsigned char *buf,
-int bufix, struct sockaddr_in *from, unsigned char *data, int buflen)
+int bufix, struct sockaddr_in *from, int buflen)
 {
struct ip *ip;
struct udphdr *udp;
+   unsigned char *data;
u_int32_t ip_len = (buf[bufix] & 0xf) << 2;
u_int32_t sum, usum;
static int ip_packets_seen;
@@ -190,7 +191,7 @@ decode_udp_ip_header(struct interface_info *interface, 
unsigned char *buf,
static int udp_packets_bad_checksum;
static int udp_packets_length_checked;
static int udp_packets_length_overflow;
-   int len = 0;
+   int len;
 
ip = (struct ip *)(buf + bufix);
udp = (struct udphdr *)(buf + bufix + ip_len);
@@ -216,30 +217,28 @@ decode_udp_ip_header(struct interface_info *interface, 
unsigned char *buf,
 
/*
 * Compute UDP checksums, including the ``pseudo-header'', the
-* UDP header and the data.   If the UDP checksum field is zero,
+* UDP header and the data. If the UDP checksum field is zero,
 * we're not supposed to do a checksum.
 */
-   if (!data) {
-   data = buf + bufix + ip_len + sizeof(*udp);
-   len = ntohs(udp->uh_ulen) - sizeof(*udp);
-   udp_packets_length_checked++;
-   if ((len < 0) || (len + data > buf + bufix + buflen)) {
-   udp_packets_length_overflow++;
-   if (udp_packets_length_checked > 4 &&
-   udp_packets_length_overflow != 0 &&
-   (udp_packets_length_checked /
-   udp_packets_length_overflow) < 2) {
-   note("%d udp packets in %d too long - dropped",
-   udp_packets_length_overflow,
-   udp_packets_length_checked);
-   udp_packets_length_overflow =
-   udp_packets_length_checked = 0;
-   }
-   return (-1);
+   data = buf + bufix + ip_len + sizeof(*udp);
+   len = ntohs(udp->uh_ulen) - sizeof(*udp);
+   udp_packets_length_checked++;
+   if ((len < 0) || (len + data > buf + bufix + buflen)) {
+   udp_packets_length_overflow++;
+   if (udp_packets_length_checked > 4 &&
+   udp_packets_length_overflow != 0 &&
+   (udp_packets_length_checked /
+   udp_packets_length_overflow) < 2) {
+   note("%d udp packets in %d too long - dropped",
+   udp_packets_length_overflow,
+   udp_packets_length_checked);
+   udp_packets_length_overflow =
+   udp_packets_length_checked = 0;
}
-   if (len + data != buf + bufix + buflen)
-   debug("accepting packet with data after udp payload.");
+   return (-1);
}
+   if (len + data != 

Re: I have a program I wish to submit for the base

2016-02-01 Thread Stuart Henderson
On 2016/02/01 08:43, Jorge Castillo wrote:
>   the only though that has come to me concerning mirrors,
> while using OpenBSD all this years is "damn it sure would be nice to know
> which mirrors there are without connecting to the internet first".

Fixed in -current, see /etc/examples/pkg.conf.

> To anyone reading this have a nice day.

thanks :)



Re: Some df(1) cleanup

2016-02-01 Thread Michael McConville
Theo Buehler wrote:
> On Mon, Feb 01, 2016 at 05:17:03PM +0100, Michal Mazurek wrote:
> > Meaningful error messages:
> >
> > mntbuf = calloc(argc, sizeof(struct statfs));
> > if (mntbuf == NULL)
> > -   err(1, NULL);
> > +   err(1, "calloc");
> 
> I disagree with the changes in this patch.  If either malloc or calloc
> fails it will typically set errno to ENOMEM, so you'll
> 
> df: Cannot allocate memory
> 
> I don't think adding the information that it was malloc or calloc that
> failed is helpful at all.

Seconded.

IIUC, the only cause of an error other than ENOMEM is a bug in the
allocator. This will definitely or almost definitely happen in a part of
the allocator that is agnostic to the function called (malloc, calloc,
etc.). So printing the function name is just noise.



ansify libarch/i386

2016-02-01 Thread Jérémie Courrèges-Anglas

ok?

Index: lib/libarch/i386/i386_get_ioperm.c
===
RCS file: /cvs/src/lib/libarch/i386/i386_get_ioperm.c,v
retrieving revision 1.7
diff -u -p -r1.7 i386_get_ioperm.c
--- lib/libarch/i386/i386_get_ioperm.c  15 Nov 2014 02:23:28 -  1.7
+++ lib/libarch/i386/i386_get_ioperm.c  31 Jan 2016 01:01:43 -
@@ -36,8 +36,7 @@
 #include 
 
 int
-i386_get_ioperm(iomap)
-   u_long *iomap;
+i386_get_ioperm(u_long *iomap)
 {
struct i386_get_ioperm_args p;
 
Index: lib/libarch/i386/i386_get_ldt.c
===
RCS file: /cvs/src/lib/libarch/i386/i386_get_ldt.c,v
retrieving revision 1.4
diff -u -p -r1.4 i386_get_ldt.c
--- lib/libarch/i386/i386_get_ldt.c 15 Nov 2014 02:23:28 -  1.4
+++ lib/libarch/i386/i386_get_ldt.c 31 Jan 2016 01:01:12 -
@@ -33,10 +33,7 @@
 #include 
 
 int
-i386_get_ldt(start, desc, num)
-   int start;
-   union descriptor *desc;
-   int num;
+i386_get_ldt(int start, union descriptor *desc, int num)
 {
struct i386_get_ldt_args p;
 
Index: lib/libarch/i386/i386_iopl.c
===
RCS file: /cvs/src/lib/libarch/i386/i386_iopl.c,v
retrieving revision 1.7
diff -u -p -r1.7 i386_iopl.c
--- lib/libarch/i386/i386_iopl.c15 Nov 2014 02:23:28 -  1.7
+++ lib/libarch/i386/i386_iopl.c30 Jan 2016 22:12:31 -
@@ -36,8 +36,7 @@
 #include 
 
 int
-i386_iopl(iopl)
-   int iopl;
+i386_iopl(int iopl)
 {
struct i386_iopl_args p;
 
Index: lib/libarch/i386/i386_set_ioperm.c
===
RCS file: /cvs/src/lib/libarch/i386/i386_set_ioperm.c,v
retrieving revision 1.7
diff -u -p -r1.7 i386_set_ioperm.c
--- lib/libarch/i386/i386_set_ioperm.c  15 Nov 2014 02:23:28 -  1.7
+++ lib/libarch/i386/i386_set_ioperm.c  30 Jan 2016 22:12:54 -
@@ -36,8 +36,7 @@
 #include 
 
 int
-i386_set_ioperm(iomap)
-   u_long *iomap;
+i386_set_ioperm(u_long *iomap)
 {
struct i386_set_ioperm_args p;
 
Index: lib/libarch/i386/i386_set_ldt.c
===
RCS file: /cvs/src/lib/libarch/i386/i386_set_ldt.c,v
retrieving revision 1.4
diff -u -p -r1.4 i386_set_ldt.c
--- lib/libarch/i386/i386_set_ldt.c 15 Nov 2014 02:23:28 -  1.4
+++ lib/libarch/i386/i386_set_ldt.c 31 Jan 2016 01:01:25 -
@@ -33,10 +33,7 @@
 #include 
 
 int
-i386_set_ldt(start, desc, num)
-   int start;
-   union descriptor *desc;
-   int num;
+i386_set_ldt(int start, union descriptor *desc, int num)
 {
struct i386_set_ldt_args p;
 
Index: lib/libarch/i386/i386_vm86.c
===
RCS file: /cvs/src/lib/libarch/i386/i386_vm86.c,v
retrieving revision 1.6
diff -u -p -r1.6 i386_vm86.c
--- lib/libarch/i386/i386_vm86.c15 Nov 2014 02:23:28 -  1.6
+++ lib/libarch/i386/i386_vm86.c30 Jan 2016 22:14:00 -
@@ -37,8 +37,7 @@
 #include 
 
 int
-i386_vm86(vmcp)
-   register struct vm86_struct *vmcp;
+i386_vm86(struct vm86_struct *vmcp)
 {
 
return sysarch(I386_VM86, vmcp);


-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



ipmi(4) - Implement ipmitool-compatible IOCTL

2016-02-01 Thread Masao Uebayashi
These two patches implement ipmitool-compatible IOCTL in ipmi(4).

IPMI BMCs are usually accessed via ethernet ports.  This provides BMC
access from within host for some situations where you can't use ethernet.

The idea is to provide generic command interface for userland via IOCTL,
while keeping minimal, critical parts (sensor reading and watchdog)
being implemented in kernel.  For example, you have to use ipmitool to
configure sensor threashold values set in BMC.

I'm checking in this in a few days, if no one objects.

(Jonathan Gray kindly did thorough review and helped to polish this patch.)
diff --git a/sys/arch/amd64/amd64/conf.c b/sys/arch/amd64/amd64/conf.c
index d69887b..e6a0913 100644
--- a/sys/arch/amd64/amd64/conf.c
+++ b/sys/arch/amd64/amd64/conf.c
@@ -183,6 +183,7 @@ cdev_decl(pci);
 #include "pppx.h"
 #include "fuse.h"
 #include "pvbus.h"
+#include "ipmi.h"
 
 struct cdevsw  cdevsw[] =
 {
@@ -294,6 +295,7 @@ struct cdevsw   cdevsw[] =
cdev_tun_init(NTUN,tap),/* 93: Ethernet network tunnel */
cdev_tty_init(NVIOCON,viocon),  /* 94: virtio console */
cdev_pvbus_init(NPVBUS,pvbus),  /* 95: pvbus(4) control interface */
+   cdev_ipmi_init(NIPMI,ipmi), /* 96: ipmi */
 };
 intnchrdev = nitems(cdevsw);
 
diff --git a/sys/arch/i386/i386/conf.c b/sys/arch/i386/i386/conf.c
index 668e137..05e82bf 100644
--- a/sys/arch/i386/i386/conf.c
+++ b/sys/arch/i386/i386/conf.c
@@ -177,6 +177,7 @@ cdev_decl(pci);
 #include "pppx.h"
 #include "fuse.h"
 #include "pvbus.h"
+#include "ipmi.h"
 
 struct cdevsw  cdevsw[] =
 {
@@ -288,6 +289,7 @@ struct cdevsw   cdevsw[] =
cdev_fuse_init(NFUSE,fuse), /* 93: fuse */ 
cdev_tun_init(NTUN,tap),/* 94: Ethernet network tunnel */
cdev_pvbus_init(NPVBUS,pvbus),  /* 95: pvbus(4) control interface */
+   cdev_ipmi_init(NIPMI,ipmi), /* 96: ipmi */
 };
 intnchrdev = nitems(cdevsw);
 
diff --git a/sys/dev/ipmi.c b/sys/dev/ipmi.c
index 5812388..a1fc350 100644
--- a/sys/dev/ipmi.c
+++ b/sys/dev/ipmi.c
@@ -1,6 +1,7 @@
 /* $OpenBSD: ipmi.c,v 1.91 2016/01/25 06:36:47 uebayasi Exp $ */
 
 /*
+ * Copyright (c) 2015 Masao Uebayashi
  * Copyright (c) 2005 Jordan Hargrave
  * All rights reserved.
  *
@@ -31,21 +32,21 @@
 #include 
 #include 
 #include 
+#include 
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
 
 #include 
-#include 
 #include 
 
 #include 
 #include 
 
 #include 
+#include 
 
 struct ipmi_sensor {
u_int8_t*i_sdr;
@@ -56,7 +57,6 @@ struct ipmi_sensor {
SLIST_ENTRY(ipmi_sensor) list;
 };
 
-intipmi_nintr;
 intipmi_enabled = 0;
 
 #define SENSOR_REFRESH_RATE (5 * hz)
@@ -140,8 +140,6 @@ SLIST_HEAD(ipmi_sensors_head, ipmi_sensor);
 struct ipmi_sensors_head ipmi_sensor_list =
 SLIST_HEAD_INITIALIZER(ipmi_sensor_list);
 
-struct timeout ipmi_timeout;
-
 void   dumpb(const char *, int, const u_int8_t *);
 
 intread_sensor(struct ipmi_softc *, struct ipmi_sensor *);
@@ -152,7 +150,6 @@ int get_sdr(struct ipmi_softc *, u_int16_t, u_int16_t *);
 
 intipmi_sendcmd(struct ipmi_cmd *);
 intipmi_recvcmd(struct ipmi_cmd *);
-void   ipmi_delay(struct ipmi_softc *, int);
 void   ipmi_cmd(struct ipmi_cmd *);
 void   ipmi_cmd_poll(struct ipmi_cmd *);
 void   ipmi_cmd_wait(struct ipmi_cmd *);
@@ -162,10 +159,14 @@ int   ipmi_watchdog(void *, int);
 void   ipmi_watchdog_tickle(void *);
 void   ipmi_watchdog_set(void *);
 
-intipmi_intr(void *);
 intipmi_match(struct device *, void *, void *);
 void   ipmi_attach(struct device *, struct device *, void *);
 intipmi_activate(struct device *, int);
+struct ipmi_softc *ipmilookup(dev_t dev);
+
+intipmiopen(dev_t, int, int, struct proc *);
+intipmiclose(dev_t, int, int, struct proc *);
+intipmiioctl(dev_t, u_long, caddr_t, int, struct proc *);
 
 long   ipow(long, int);
 long   ipmi_convert(u_int8_t, struct sdrtype1 *, long);
@@ -174,10 +175,7 @@ void   ipmi_sensor_name(char *, int, u_int8_t, 
u_int8_t *);
 /* BMC Helper Functions */
 u_int8_t bmc_read(struct ipmi_softc *, int);
 void   bmc_write(struct ipmi_softc *, int, u_int8_t);
-intbmc_io_wait(struct ipmi_softc *, int, u_int8_t, u_int8_t, const char *);
-intbmc_io_wait_cold(struct ipmi_softc *, int, u_int8_t, u_int8_t,
-const char *);
-void   _bmc_io_wait(void *);
+intbmc_io_wait(struct ipmi_softc *, struct ipmi_iowait *);
 
 void   bt_buildmsg(struct ipmi_cmd *);
 void   cmn_buildmsg(struct ipmi_cmd *);
@@ -268,83 +266,29 @@ bmc_write(struct ipmi_softc *sc, int offset, u_int8_t val)
offset * sc->sc_if_iospacing, val);
 }
 
-void
-_bmc_io_wait(void *arg)
-{
-   struct ipmi_softc   *sc = arg;
-   struct ipmi_bmc_args*a = sc->sc_iowait_args;
-
-   *a->v = bmc_read(sc, a->offset);
-   if ((*a->v & a->mask) == a->value) {
-   sc->sc_wakeup = 0;
-   wakeup(sc);
-   return;
-   }
-
-   if (++sc->sc_retries > 

Re: unused variable in init(8)

2016-02-01 Thread Sebastien Marie
On Mon, Feb 01, 2016 at 08:05:42PM +0100, Jérémie Courrèges-Anglas wrote:
> 
> Not needed since rev. 1.55 and the introduction of crypt_checkpass().
> 
> ok?

I have the same in my tree.

ok semarie@

> Index: init.c
> ===
> RCS file: /cvs/src/sbin/init/init.c,v
> retrieving revision 1.57
> diff -u -p -p -u -r1.57 init.c
> --- init.c23 Dec 2015 02:41:12 -  1.57
> +++ init.c1 Feb 2016 17:57:46 -
> @@ -517,7 +517,7 @@ f_single_user(void)
>   struct passwd *pp;
>   static const char banner[] =
>   "Enter root password, or ^D to go multi-user\n";
> - char *clear, *password;
> + char *clear;
>  #endif
>  
>   /* Init shell and name */
> 
> -- 
> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE
> 
> 

-- 
Sebastien Marie



Re: sunxi: don't use sxitimer on the sun7i/A20

2016-02-01 Thread Artturi Alm
On Tue, Feb 02, 2016 at 10:55:57AM +1100, Jonathan Gray wrote:
> On Mon, Feb 01, 2016 at 02:55:52AM +0200, Artturi Alm wrote:
> > On Sun, Jan 31, 2016 at 10:45:42PM +1100, Jonathan Gray wrote:
> > > On Sun, Jan 31, 2016 at 10:12:05AM +0200, Artturi Alm wrote:
> > > > On Sun, Jan 31, 2016 at 01:14:35AM +0100, Patrick Wildt wrote:
> > > > > Hi,
> > > > > 
> > > > > one of the reasons Allwinner A20/sun7i-based boards, like the
> > > > > Cubieboard 2 or Banana Pi, don't boot is that the sxitimer does
> > > > > not work for us.  We are getting no hardclock ticks and so the
> > > > > system can't work.
> > > > > 
> > > > > There's a simple fix for that.  We can just not use the sxitimer
> > > > > and instead use the ARM architected timer (agtimer) that is
> > > > > supposed to be a generic implementation for all new cores and
> > > > > already attaches anyway.  The sxitimer attachment currently
> > > > > overrides the agtimer.  Removing sxitimer thus allows agtimer
> > > > > to actually do its work.
> > > > > 
> > > > > Currently sxirtc uncondtionally ties into sxitimer.  To make
> > > > > this work, just make sxirtc map its own page instead of relying
> > > > > on the existence of a mapping created by sxitimer.
> > > > > 
> > > > > The address/size used for the sxirtc is from a device tree
> > > > > source.
> > > > > 
> > > > > Patrick
> > > > > 
> > > > 
> > > > Hi,
> > > > 
> > > > nothing i would change about your diff, given now there's agtimer,
> > > > but it doesn't really seem to even try fixing rtc on A20, and leaves
> > > > ugly glue into sxitimer written just for A20, which imho should also
> > > > get cleaned up.
> > > > 
> > > > -Artturi
> > > 
> > > There seem to be at least two diffs here, the different rtc handling
> > > for a20 should be split out, store sxirtc_a20 in the softc and fix
> > > the test from
> > > if (BOARD_ID_SUN7I_A20)
> > > to
> > > if (board_id == BOARD_ID_SUN7I_A20)
> > > 
> > 
> > Yes, it was quick try during my morning coffee, i'm sorry to have wasted
> > your time with the previous obviously wrong diff.
> > 
> > sxitimer a20 support glue cleanup diff inline.
> > 
> > -Artturi
> 
> Thanks, both diffs committed.  Any chance you could create another to
> move the sxitimer_* globals into the softc?

Sure, here's fix for sxidog while waiting, i know the mapping does overlap
with sxitimer, but that is what sxirtc already does too since Patrick's diff
without problems.
As is, sxidog is the last user of 'extern bus_.._t sxitimer_ioh;', and use of
it on A20 is now obviously wrong, and might mean that reboot ends up spinning.

-Artturi


diff --git a/sys/arch/armv7/sunxi/sunxireg.h b/sys/arch/armv7/sunxi/sunxireg.h
index 323264b..c82990c 100644
--- a/sys/arch/armv7/sunxi/sunxireg.h
+++ b/sys/arch/armv7/sunxi/sunxireg.h
@@ -65,7 +65,7 @@
 #defineTIMER2_IRQ  24
 #defineSTATTIMER_IRQ   TIMER1_IRQ /* XXX */
 
-#defineWDOG_ADDR   0x90
+#defineWDOG_ADDR   0x01c20c90
 #defineWDOG_SIZE   0x08
 #defineWDOG_IRQ24
 
diff --git a/sys/arch/armv7/sunxi/sxidog.c b/sys/arch/armv7/sunxi/sxidog.c
index 6212e58..347b534 100644
--- a/sys/arch/armv7/sunxi/sxidog.c
+++ b/sys/arch/armv7/sunxi/sxidog.c
@@ -30,9 +30,6 @@
 #include 
 #include 
 
-/* XXX other way around than bus_space_subregion? */
-extern bus_space_handle_t sxitimer_ioh;
-
 /* registers */
 #define WDOG_CR0x00
 #define WDOG_MR0x04
@@ -89,9 +86,9 @@ sxidog_attach(struct device *parent, struct device *self, 
void *args)
struct sxidog_softc *sc = (struct sxidog_softc *)self;
 
sc->sc_iot = aa->aa_iot;
-   if (bus_space_subregion(sc->sc_iot, sxitimer_ioh,
-   aa->aa_dev->mem[0].addr, aa->aa_dev->mem[0].size, >sc_ioh))
-   panic("sxidog_attach: bus_space_subregion failed!");
+   if (bus_space_map(sc->sc_iot, aa->aa_dev->mem[0].addr,
+   aa->aa_dev->mem[0].size, 0, >sc_ioh))
+   panic("sxidog_attach: bus_space_map failed!");
 
 #ifdef DEBUG
printf(": ctrl %x mode %x\n", SXIREAD4(sc, WDOG_CR),



Re: ldapd: add -r option to specify datadir path

2016-02-01 Thread Jérémie Courrèges-Anglas
j...@wxcvbn.org (Jérémie Courrèges-Anglas) writes:

> Sebastien Marie  writes:
>
>> On Sun, Jan 31, 2016 at 09:39:52AM +0100, Landry Breuil wrote:
>>> Hi,
>>> 
>>> i'm tinkering with ldapd and writing regress tests for it, and to
>>> allow running independent instances (with separate port/control
>>> socket/etc) i needed to add the possibility to specify an alternative
>>> datadir, which was so far #defined in the code.
>>> Patch is pretty simple and works fine, i'm open to suggestions of course
>>> on a better wording for the manpage and option choose (i went for -r..)
>>> okays welcome too !
>>> 
>>
>> the diff looks good and it would permit to make regress tests, so OK 
>> semarie@ :)
>
> I have smallish tweaks to propose but nothing that prevents this diff to
> go in as is.  ok jca@

Since both ldapd and ldapctl may access the db, ldapctl should be
modified similarly.

Comments/ok?

Index: ldapctl.8
===
RCS file: /cvs/src/usr.sbin/ldapctl/ldapctl.8,v
retrieving revision 1.4
diff -u -p -r1.4 ldapctl.8
--- ldapctl.8   21 Jul 2010 06:32:14 -  1.4
+++ ldapctl.8   1 Feb 2016 17:57:55 -
@@ -24,6 +24,7 @@
 .Nm ldapctl
 .Op Fl v
 .Op Fl f Ar file
+.Op Fl r Ar datadir
 .Op Fl s Ar socket
 .Ar command
 .Op Ar argument ...
@@ -41,6 +42,11 @@ Use
 .Ar file
 as the configuration file, instead of the default
 .Pa /etc/ldapd.conf .
+.It Fl r Ar directory
+Store and read database files in
+.Ar directory
+, instead of the default
+.Pa /var/db/ldap .
 .It Fl s Ar socket
 Use
 .Ar socket
Index: ldapctl.c
===
RCS file: /cvs/src/usr.sbin/ldapctl/ldapctl.c,v
retrieving revision 1.7
diff -u -p -r1.7 ldapctl.c
--- ldapctl.c   5 Dec 2015 13:19:13 -   1.7
+++ ldapctl.c   1 Feb 2016 17:57:55 -
@@ -56,10 +56,10 @@ void show_stats(struct imsg *imsg);
 voidshow_dbstats(const char *prefix, struct btree_stat *st);
 voidshow_nsstats(struct imsg *imsg);
 int compact_db(const char *path);
-int compact_namespace(struct namespace *ns);
-int compact_namespaces(void);
-int index_namespace(struct namespace *ns);
-int index_namespaces(void);
+int compact_namespace(struct namespace *ns, const char *datadir);
+int compact_namespaces(const char *datadir);
+int index_namespace(struct namespace *ns, const char *datadir);
+int index_namespaces(const char *datadir);
 
 __dead void
 usage(void)
@@ -67,7 +67,8 @@ usage(void)
extern char *__progname;
 
fprintf(stderr,
-   "usage: %s [-v] [-f file] [-s socket] command [argument ...]\n",
+   "usage: %s [-v] [-f file] [-r directory] [-s socket] "
+   "command [argument ...]\n",
__progname);
exit(1);
 }
@@ -93,11 +94,11 @@ compact_db(const char *path)
 }
 
 int
-compact_namespace(struct namespace *ns)
+compact_namespace(struct namespace *ns, const char *datadir)
 {
char*path;
 
-   if (asprintf(, "%s/%s_data.db", DATADIR, ns->suffix) < 0)
+   if (asprintf(, "%s/%s_data.db", datadir, ns->suffix) < 0)
return -1;
if (compact_db(path) != 0) {
log_warn("%s", path);
@@ -106,7 +107,7 @@ compact_namespace(struct namespace *ns)
}
free(path);
 
-   if (asprintf(, "%s/%s_indx.db", DATADIR, ns->suffix) < 0)
+   if (asprintf(, "%s/%s_indx.db", datadir, ns->suffix) < 0)
return -1;
if (compact_db(path) != 0) {
log_warn("%s", path);
@@ -119,19 +120,22 @@ compact_namespace(struct namespace *ns)
 }
 
 int
-compact_namespaces(void)
+compact_namespaces(const char *datadir)
 {
struct namespace*ns;
 
-   TAILQ_FOREACH(ns, >namespaces, next)
-   if (SLIST_EMPTY(>referrals) && compact_namespace(ns) != 0)
+   TAILQ_FOREACH(ns, >namespaces, next) {
+   if (SLIST_EMPTY(>referrals))
+   continue;
+   if (compact_namespace(ns, datadir) != 0)
return -1;
+   }
 
return 0;
 }
 
 int
-index_namespace(struct namespace *ns)
+index_namespace(struct namespace *ns, const char *datadir)
 {
struct btval key, val;
struct btree*data_db, *indx_db;
@@ -150,7 +154,7 @@ index_namespace(struct namespace *ns)
if (data_db == NULL)
return -1;
 
-   if (asprintf(, "%s/%s_indx.db", DATADIR, ns->suffix) < 0)
+   if (asprintf(, "%s/%s_indx.db", datadir, ns->suffix) < 0)
return -1;
indx_db = btree_open(path, BT_NOSYNC, 0644);
free(path);
@@ -212,13 +216,16 @@ index_namespace(struct namespace *ns)
 }
 
 int
-index_namespaces(void)
+index_namespaces(const char *datadir)
 {
struct namespace*ns;
 
-   TAILQ_FOREACH(ns, 

Re: can't run multiple instances of httpd, flags not visible in processes

2016-02-01 Thread Stuart Henderson
On 2016/02/01 15:02, Joerg Jung wrote:
> 
> > On 01 Feb 2016, at 14:53, Stuart Henderson  wrote:
> > 
> > moved from misc.
> > 
> > On 2016-01-28, Antoine Jacoutot  wrote:
> >>> Well, we "tradionally" had setproctitle("[priv]") in the parent.  I
> >>> changed the tradition to setproctitle("parent").
> >>> 
> >>> I have no objections with changing this in the parent (but keeping the
> >>> setproctitles in the children) to either the default (all command line
> >>> flags) or to something like setproctitle("parent, %s", conffile).
> >>> Command line flags suck and I don't think that -d or -v would be
> >>> helpful in the output, so I prefer the latter.
> >> 
> >> "-v" is helpful at least for rc.d which needs to match the full args list 
> >> by default
> >> 
> >>> All rc scripts would have to be adjusted by somebody with better rc-fu.
> >> 
> >> Actually if things are properly done, the non default pexp line in the 
> >> rc.d scripts should just be removed and that's it.
> >> 
> > 
> > Here it is for the majority of base daemons. I've left ypldap for now,
> > the rc script matches "ldap client" not "parent". radiusd already leaves
> > the parent process title as-is (the setproctitle("[main]") are separate
> > processes).
> > 
> > OK?
> 
> ok jung@
> 
> What about smtpd, should be similar, no?

Ah yes, well spotted. Missed in my grep because setproctitle isn't
called directly with the name, but in config_process() from a string
instead.



install(1) typo

2016-02-01 Thread Jan Stary
There seems to be a "be" missing in install(1).

The whole phrase seems odd to a non-native speaker like me:
those options "should not be relied upon" because they are not portable,
not "for portability". (But I might easily be wrong.)

Jan



--- install.1.orig  Mon Feb  1 13:57:31 2016
+++ install.1   Mon Feb  1 13:58:00 2016
@@ -215,7 +215,7 @@ The
 .Fl p ,
 and
 .Fl S
-flags are non-standard and should not relied upon for portability.
+flags are non-standard and should not be relied upon for portability.
 .Pp
 Temporary files may be left in the target directory if
 .Nm



Re: I have a program I wish to submit for the base

2016-02-01 Thread Jorge Castillo
I can't comment on code quality since I suck at programming but you
yourself said your program does not follow style(9) as much as it could, I
think this is not a good start. Why not make it a port? If this becomes
useful to a lot of people then maybe it can be in base later, but not
before it shows to be wildly popular. To be frank a file with all available
mirrors is as good as it gets for me, I've never felt the need to see which
mirror is faster, the only though that has come to me concerning mirrors,
while using OpenBSD all this years is "damn it sure would be nice to know
which mirrors there are without connecting to the internet first". To
anyone reading this have a nice day.


Re: install(1) typo

2016-02-01 Thread Jason McIntyre
On Mon, Feb 01, 2016 at 04:27:06PM +0100, Jan Stary wrote:
> There seems to be a "be" missing in install(1).
> 
> The whole phrase seems odd to a non-native speaker like me:
> those options "should not be relied upon" because they are not portable,
> not "for portability". (But I might easily be wrong.)
> 
>   Jan
> 

fixed, thanks.
jmc

> 
> 
> --- install.1.origMon Feb  1 13:57:31 2016
> +++ install.1 Mon Feb  1 13:58:00 2016
> @@ -215,7 +215,7 @@ The
>  .Fl p ,
>  and
>  .Fl S
> -flags are non-standard and should not relied upon for portability.
> +flags are non-standard and should not be relied upon for portability.
>  .Pp
>  Temporary files may be left in the target directory if
>  .Nm
> 



Re: ldapd: add -r option to specify datadir path

2016-02-01 Thread Jérémie Courrèges-Anglas
Sebastien Marie  writes:

> On Sun, Jan 31, 2016 at 09:39:52AM +0100, Landry Breuil wrote:
>> Hi,
>> 
>> i'm tinkering with ldapd and writing regress tests for it, and to
>> allow running independent instances (with separate port/control
>> socket/etc) i needed to add the possibility to specify an alternative
>> datadir, which was so far #defined in the code.
>> Patch is pretty simple and works fine, i'm open to suggestions of course
>> on a better wording for the manpage and option choose (i went for -r..)
>> okays welcome too !
>> 
>
> the diff looks good and it would permit to make regress tests, so OK semarie@ 
> :)

I have smallish tweaks to propose but nothing that prevents this diff to
go in as is.  ok jca@

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



df(1) - use return, not exit() in main()

2016-02-01 Thread Michal Mazurek
Replace exit() with return.

Index: df.c
===
RCS file: /cvs/src/bin/df/df.c,v
retrieving revision 1.54
diff -u -p -r1.54 df.c
--- df.c9 Oct 2015 01:37:06 -   1.54
+++ df.c1 Feb 2016 17:58:59 -
@@ -178,7 +178,7 @@ main(int argc, char *argv[])
bsdprint(mntbuf, mntsize, maxwidth);
}
 
-   exit(mntsize ? 0 : 1);
+   return mntsize ? 0 : 1;
 }
 
 char *


But perhaps the logic is incorrect:
$ df -t nfs
$ echo $?
1
Is an empty list an error? GNU df returns 1 with an error message "df:
no file systems processed". NetBSD returns 0, but only because it
doesn't have this commit.

Commit 1.39 "Don't print header if we didn't print any usage lines."
contained the change:

-   exit(0);
+   exit(mntsize ? 0 : 1);

-- 
Michal Mazurek