Hi there sys/mman.h, mmap() and munmap() gets used unconditional --- source/tdb/tdbback.c.orig 2003-07-01 16:40:46.000000000 +0200 +++ source/tdb/tdbback.c 2003-09-30 11:51:05.000000000 +0200 @@ -26,7 +26,9 @@ #include <string.h> #include <fcntl.h> #include <time.h> +#ifdef HAVE_SYS_MMAN_H #include <sys/mman.h> +#endif #include <sys/stat.h> #include <sys/time.h> #include <ctype.h> --- source/tdb/tdbbackup.c.orig 2003-07-01 22:44:26.000000000 +0200 +++ source/tdb/tdbbackup.c 2003-09-30 14:29:05.000000000 +0200 @@ -49,7 +49,9 @@ #include <string.h> #include <fcntl.h> #include <time.h> +#ifdef HAVE_SYS_MMAN_H #include <sys/mman.h> +#endif #include <sys/stat.h> #include <sys/time.h> #include <ctype.h> --- source/utils/profiles.c.orig 2003-08-15 22:40:01.000000000 +0200 +++ source/utils/profiles.c 2003-09-30 14:47:04.000000000 +0200 @@ -295,7 +295,9 @@ #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> +#ifdef HAVE_SYS_MMAN_h #include <sys/mman.h> +#endif typedef unsigned int DWORD; typedef unsigned short WORD; @@ -610,7 +612,11 @@ * dealing with the records. We are interested in the sk record */ start = 0; +#ifdef HAVE_MMAP base = mmap(&start, sbuf.st_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); +#else + base = (char *)-1; +#endif if ((int)base == -1) { fprintf(stderr, "Could not mmap file: %s, %s\n", poptPeekArg(pc), @@ -726,7 +732,9 @@ sk_hdr = (SK_HDR *)(base + OFF(IVAL(&sk_hdr->prev_off, 0))); } while (sk_off != first_sk_off); +#ifdef HAVE_MMAP munmap(base, sbuf.st_size); +#endif poptFreeContext(pc); Bye, Jojo
Applied (a varient of these). Thanks, Jeremy.
Hi there I found that another additional line is needed in utils/profiles.c, at the point in my patch where base is set to(char *)-1 we additionally need to set errno to ENOSYS to get a meaningfull error message from the strerror(errno) called a few lines later. Bye, Jojo
Checked in. Thanks. It's a bit silly that profiles doesn't work if mmap() isn't supported though. )-:
sorry for the same, cleaning up the database to prevent unecessary reopens of bugs.