Date: Mon, 16 May 2005 14:11:42 +0300 From: Juho Vuori <juho.vuori@kepa.fi> To: freebsd-hackers@freebsd.org Subject: Bug in devinfo or something wrong with me? Message-ID: <42887FEE.3000705@kepa.fi>
next in thread | raw e-mail | index | archive | help
The below included simple program reliably printfs "error 4\n" on
5.4-RELEASE. Am I understanding something wrong or is this a bug in
libdevinfo?
To continue on this however, if you put say sleep(5) between
devinfo_free() and the second devinfo_init() and manage to change the
device configuration during the sleep (tested with pluggin in/out a USB
memory), the program terminates with no errors. I've run into other
oddities with devinfo as well, but in much more complex situations so
they might just as well be variations of this simple example.
Juho
/* save this as test.c and compile:
* cc -o test test.c -ldevinfo
*/
#include <sys/types.h>
#include <devinfo.h>
int
main () {
struct devinfo_dev *root;
if (devinfo_init()) {
printf("error 1\n");
return -1;
}
if ((root = devinfo_handle_to_device(DEVINFO_ROOT_DEVICE)) == 0) {
printf("error 2\n");
return -1;
}
devinfo_free();
if (devinfo_init()) {
printf("error 3\n");
return -1;
}
if ((root = devinfo_handle_to_device(DEVINFO_ROOT_DEVICE)) == 0) {
printf("error 4\n");
return -1;
}
devinfo_free();
printf("no errors\n");
return 0;
}
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?42887FEE.3000705>
