Samuel Thibault, le Tue 29 Dec 2009 23:34:08 +0100, a écrit :
> > OK, I can use that for the client side. I don't really have a setup
> > for testing the auth server though. Do you use a sub-Hurd or something?
>
> I've never managed to find time to set up a sub-hurd, so I just debug
> with writes on the console :)
More precisely, I use
#include <stdio.h>
#include <device/device.h>
static void mylog(const char *fmt, ...)
{
static mach_port_t device = MACH_PORT_NULL;
if (device == MACH_PORT_NULL) {
mach_port_t priv, dev;
if (! get_privileged_ports(NULL, &priv)
&& ! device_open(priv, D_WRITE, "console", &dev))
device = dev;
}
if (device != MACH_PORT_NULL) {
char s[128];
int n;
va_list vap;
va_start(vap, fmt);
n = vsnprintf(s, sizeof(s), fmt, vap);
va_end(vap);
device_write(device, 0, 0, s, n, &n);
}
}
Samuel