From a25d4c2e7ea3741c5cf44d17d955c9bae91ca128 Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Tue, 23 Nov 2004 22:32:16 +0000 Subject: various fixes --- lib/fuse.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'lib/fuse.c') diff --git a/lib/fuse.c b/lib/fuse.c index b29db9d..59f8b45 100644 --- a/lib/fuse.c +++ b/lib/fuse.c @@ -17,6 +17,9 @@ #include #include +#define FUSE_VERSION_FILE_OLD "/proc/fs/fuse/version" +#define FUSE_DEV_OLD "/proc/fs/fuse/dev" + #define FUSE_MAX_PATH 4096 #define PARAM(inarg) (((char *)(inarg)) + sizeof(*inarg)) @@ -1722,12 +1725,18 @@ static int check_version(struct fuse *f) const char *version_file = FUSE_VERSION_FILE; FILE *vf = fopen(version_file, "r"); if (vf == NULL) { - version_file = "/sys/fs/fuse/version"; + version_file = FUSE_VERSION_FILE_OLD; vf = fopen(version_file, "r"); if (vf == NULL) { - fprintf(stderr, "fuse: kernel interface too old, need >= %i.%i\n", - FUSE_KERNEL_VERSION, FUSE_KERNEL_MINOR_VERSION); - return -1; + struct stat tmp; + if (stat(FUSE_DEV_OLD, &tmp) != -1) { + fprintf(stderr, "fuse: kernel interface too old, need >= %i.%i\n", + FUSE_KERNEL_VERSION, FUSE_KERNEL_MINOR_VERSION); + return -1; + } else { + fprintf(stderr, "fuse: warning: version of kernel interface unknown\n"); + return 0; + } } } res = fscanf(vf, "%i.%i", &f->majorver, &f->minorver); @@ -1817,7 +1826,17 @@ struct fuse *fuse_new(int fd, const char *opts, const struct fuse_operations *op if (f->id_table == NULL) goto out_free_name_table; - pthread_mutex_init(&f->lock, NULL); +#ifndef USE_UCLIBC + pthread_mutex_init(&f->lock, NULL); +#else + { + pthread_mutexattr_t attr; + pthread_mutexattr_init(&attr); + pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ADAPTIVE_NP); + pthread_mutex_init(&f->lock, &attr); + pthread_mutexattr_destroy(&attr); + } +#endif f->numworker = 0; f->numavail = 0; f->op = *op; -- cgit v1.2.3