diff -Nur squashfs4.0.orig/squashfs-tools/mksquashfs.c squashfs4.0/squashfs-tools/mksquashfs.c --- squashfs4.0.orig/squashfs-tools/mksquashfs.c Sun Apr 5 23:22:48 2009 +++ squashfs4.0/squashfs-tools/mksquashfs.c Tue Dec 29 18:23:15 2009 @@ -48,16 +48,9 @@ #include #include -#ifndef linux -#define __BYTE_ORDER BYTE_ORDER -#define __BIG_ENDIAN BIG_ENDIAN -#define __LITTLE_ENDIAN LITTLE_ENDIAN -#include -#else -#include -#include -#endif +#include + #include "squashfs_fs.h" #include "squashfs_swap.h" #include "mksquashfs.h" @@ -3688,23 +3681,9 @@ signal(SIGUSR1, sigusr1_handler); if(processors == -1) { -#ifndef linux - int mib[2]; - size_t len = sizeof(processors); - - mib[0] = CTL_HW; -#ifdef HW_AVAILCPU - mib[1] = HW_AVAILCPU; +#if defined(BSD) + processors = 1; #else - mib[1] = HW_NCPU; -#endif - - if(sysctl(mib, 2, &processors, &len, NULL, 0) == -1) { - ERROR("Failed to get number of available processors. " - "Defaulting to 1\n"); - processors = 1; - } -#else processors = get_nprocs(); #endif } @@ -3974,9 +3953,15 @@ int match = use_regex ? regexec(path->name[i].preg, name, (size_t) 0, NULL, 0) == 0 : +#if defined(BSD) fnmatch(path->name[i].name, name, + FNM_PATHNAME|FNM_PERIOD) == + 0; +#else + fnmatch(path->name[i].name, name, FNM_PATHNAME|FNM_PERIOD|FNM_EXTMATCH) == 0; +#endif if(match && path->name[i].paths == NULL) { /* match on a leaf component, any subdirectories diff -Nur squashfs4.0.orig/squashfs-tools/pseudo.c squashfs4.0/squashfs-tools/pseudo.c --- squashfs4.0.orig/squashfs-tools/pseudo.c Sun Apr 5 04:01:58 2009 +++ squashfs4.0/squashfs-tools/pseudo.c Tue Dec 29 18:07:33 2009 @@ -30,6 +30,11 @@ #include #include #include +#include + +#if defined(BSD) +#include +#endif #include "pseudo.h" diff -Nur squashfs4.0.orig/squashfs-tools/unsquashfs.c squashfs4.0/squashfs-tools/unsquashfs.c --- squashfs4.0.orig/squashfs-tools/unsquashfs.c Sun Apr 5 23:23:06 2009 +++ squashfs4.0/squashfs-tools/unsquashfs.c Tue Dec 29 18:25:56 2009 @@ -21,6 +21,8 @@ * unsquashfs.c */ +#include + #include "unsquashfs.h" #include "squashfs_swap.h" #include "squashfs_compat.h" @@ -1193,10 +1195,17 @@ struct pathname *path = paths->path[n]; for(i = 0; i < path->names; i++) { int match = use_regex ? +#if defined(BSD) regexec(path->name[i].preg, name, (size_t) 0, NULL, 0) == 0 : fnmatch(path->name[i].name, + name, FNM_PATHNAME|FNM_PERIOD) == + 0; +#else + regexec(path->name[i].preg, name, (size_t) 0, + NULL, 0) == 0 : fnmatch(path->name[i].name, name, FNM_PATHNAME|FNM_PERIOD|FNM_EXTMATCH) == 0; +#endif if(match && path->name[i].paths == NULL) /* * match on a leaf component, any subdirectories @@ -1795,21 +1804,7 @@ if(processors == -1) { #ifndef linux - int mib[2]; - size_t len = sizeof(processors); - - mib[0] = CTL_HW; -#ifdef HW_AVAILCPU - mib[1] = HW_AVAILCPU; -#else - mib[1] = HW_NCPU; -#endif - - if(sysctl(mib, 2, &processors, &len, NULL, 0) == -1) { - ERROR("Failed to get number of available processors. " - "Defaulting to 1\n"); - processors = 1; - } + processors = 1; #else processors = get_nprocs(); #endif