pkgsrc/filesystems/fuse-chironfs/patches/patch-ab
pooka 9796a74f4d ChironFS, replicating file system which operates like RAID1 on a
file system level, i.e. is configured by collecting several
mountpoints into one virtual replicated file system.
2007-11-27 18:55:40 +00:00

82 lines
2.1 KiB
Text

$NetBSD: patch-ab,v 1.1.1.1 2007/11/27 18:55:40 pooka Exp $
--- src/chiron-conf.c.orig 2007-10-23 04:54:53.000000000 +0200
+++ src/chiron-conf.c 2007-11-27 18:05:11.000000000 +0100
@@ -34,7 +34,11 @@
#include <dlfcn.h>
#include <libgen.h>
+#ifdef __linux__
#include <linux/limits.h>
+#else
+#include <limits.h>
+#endif
#include <string.h>
#include <stdint.h>
#include <sys/resource.h>
@@ -232,7 +236,8 @@
int do_mount(char *filesystems, char *mountpoint)
{
char buf[100];
- int i, start, fd, res, errno, rep_on_mount=0, err;
+ int fd, res;
+ int i, start, errno, rep_on_mount=0, err;
int *tmp_high, *tmp_low;
unsigned long tmpfd;
struct rlimit rlp;
@@ -249,21 +254,21 @@
}
fd = open("/proc/sys/fs/file-max",O_RDONLY);
- if (fd<0) {
- print_err(errno,"opening /proc/sys/fs/file-max");
- exit(errno);
- }
- res = read(fd,buf,99);
- if (res<0) {
- print_err(errno,"reading /proc/sys/fs/file-max");
- exit(errno);
+ if (fd != -1) {
+ res = read(fd,buf,99);
+ if (res<0) {
+ print_err(errno,"reading /proc/sys/fs/file-max");
+ exit(errno);
+ }
+ sscanf(buf,"%qu",&FD_BUF_SIZE);
+ close(fd);
+ } else {
+ FD_BUF_SIZE = 4096;
}
- sscanf(buf,"%qu",&FD_BUF_SIZE);
- close(fd);
tmpfd = (FD_BUF_SIZE >>= 1);
- if (getrlimit(RLIMIT_OFILE,&rlp)) {
+ if (getrlimit(RLIMIT_NOFILE,&rlp)) {
print_err(errno,"reading nofile resource limit");
exit(errno);
}
@@ -356,11 +361,11 @@
}
if (mountpoint[0]==':') {
- mount_point = realpath(mountpoint+1,NULL);
+ mount_point = do_realpath(mountpoint+1,NULL);
rep_on_mount = i = 1;
tmp_high[max_replica_high++] = 0;
} else {
- mount_point = realpath(mountpoint,NULL);
+ mount_point = do_realpath(mountpoint,NULL);
i = 0;
}
if (mount_point==NULL) {
@@ -380,7 +385,7 @@
tmp_high[max_replica_high++] = i;
}
- paths[i].path = realpath(filesystems+start, NULL);
+ paths[i].path = do_realpath(filesystems+start, NULL);
if (paths[i].path==NULL) {
free_paths();
free_tab_fd();