[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Mldonkey-commits] Changes to mldonkey/src/config/unix/os_stubs_c.c
From: |
mldonkey-commits |
Subject: |
[Mldonkey-commits] Changes to mldonkey/src/config/unix/os_stubs_c.c |
Date: |
Sun, 07 Aug 2005 13:39:42 -0400 |
Index: mldonkey/src/config/unix/os_stubs_c.c
diff -u mldonkey/src/config/unix/os_stubs_c.c:1.7
mldonkey/src/config/unix/os_stubs_c.c:1.8
--- mldonkey/src/config/unix/os_stubs_c.c:1.7 Mon Aug 1 20:09:13 2005
+++ mldonkey/src/config/unix/os_stubs_c.c Sun Aug 7 17:39:30 2005
@@ -111,114 +111,6 @@
}
-#ifdef HAVE_SYS_PARAM_H
-# include <sys/param.h>
-# if (defined(__FreeBSD__) && __FreeBSD_version >= 503001) ||
defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__)
-# include <sys/mount.h>
-# define HAVE_STATS 1
-# endif
-#endif
-#ifdef HAVE_SYS_VFS_H
-# include <sys/vfs.h>
-# define HAVE_STATS 1
-#endif
-
-#ifdef HAVE_STATS
-static value
-#if ((defined (sun) || defined (__sun__)))
-copy_statfs (struct statvfs *buf)
-#else
-copy_statfs (struct statfs *buf)
-#endif
-{
- CAMLparam0 ();
- CAMLlocal2 (bufv, v);
- bufv = caml_alloc (11, 0);
-#if ((defined (sun) || defined (__sun__))) || (defined(__FreeBSD__) &&
__FreeBSD_version >= 503001) || defined(__OpenBSD__) || defined(__NetBSD__)
- v = copy_int64 (-1); caml_modify (&Field (bufv, 0), v);
-#else
- v = copy_int64 (buf->f_type); caml_modify (&Field (bufv, 0), v);
-#endif /* ((defined (sun) || defined (__sun__))) || (defined(__FreeBSD__) &&
__FreeBSD_version >= 503001) || defined(__OpenBSD__) || defined(__NetBSD__) */
- v = copy_int64 (buf->f_bsize); caml_modify (&Field (bufv, 1), v);
- v = copy_int64 (buf->f_blocks); caml_modify (&Field (bufv, 2), v);
- v = copy_int64 (buf->f_bfree); caml_modify (&Field (bufv, 3), v);
- v = copy_int64 (buf->f_bavail); caml_modify (&Field (bufv, 4), v);
- v = copy_int64 (buf->f_files); caml_modify (&Field (bufv, 5), v);
- v = copy_int64 (buf->f_ffree); caml_modify (&Field (bufv, 6), v);
-#if ((defined (sun) || defined (__sun__)))
- v = copy_int64 (-1); caml_modify (&Field (bufv, 7), v);
- v = copy_int64 (buf->f_namemax); caml_modify (&Field (bufv, 8), v);
- v = copy_string (buf->f_basetype); caml_modify (&Field (bufv, 9), v);
- v = copy_int64 (buf->f_frsize); caml_modify (&Field (bufv, 10), v);
-#else
-#if (defined(__FreeBSD__) && __FreeBSD_version >= 503001) ||
defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__)
-# if defined(__OpenBSD__) || defined(__NetBSD__)
-# include <sys/syslimits.h>
- v = copy_int64 (NAME_MAX); caml_modify (&Field (bufv, 8), v);
-# else
-# if defined(__APPLE__)
-# include <unistd.h>
- v = copy_int64 (_PC_NAME_MAX); caml_modify (&Field (bufv ,8 ), v);
-# else
- v = copy_int64 (buf->f_namemax); caml_modify (&Field (bufv, 8), v);
-# endif /* (__APPLE__) */
-# endif /* (__OpenBSD__) || defined(__NetBSD__) */
- v = copy_string (buf->f_fstypename); caml_modify (&Field (bufv, 9), v);
-#else
- v = copy_int64 (buf->f_namelen); caml_modify (&Field (bufv, 8), v);
- v = copy_string ("-1"); caml_modify (&Field (bufv, 9), v);
-#endif /* (defined(__FreeBSD__) && __FreeBSD_version >= 503001) ||
defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__) */
- caml_modify (&Field (bufv, 7), Val_unit);
- v = copy_int64 (-1); caml_modify (&Field (bufv, 10), v);
-#endif /* ((defined (sun) || defined (__sun__))) */
- CAMLreturn (bufv);
-}
-#endif
-
-CAMLprim value
-statfs_statfs (value pathv)
-{
-#ifdef HAVE_STATS
- CAMLparam1 (pathv);
- CAMLlocal1 (bufv);
- const char *path = String_val (pathv);
-#if ((defined (sun) || defined (__sun__)))
- struct statvfs buf;
- if (statvfs (path, &buf) == -1)
-#else
- struct statfs buf;
- if (statfs (path, &buf) == -1)
-#endif
- raise_constant(*(value *)caml_named_value("error"));
- bufv = copy_statfs (&buf);
- CAMLreturn (bufv);
-#else
- raise_constant(*(value *)caml_named_value("not supported"));
-#endif
-}
-
-CAMLprim value
-statfs_fstatfs (value fdv)
-{
-#ifdef HAVE_STATS
- CAMLparam1 (fdv);
- CAMLlocal1 (bufv);
- int fd = Int_val (fdv);
-#if ((defined (sun) || defined (__sun__)))
- struct statvfs buf;
- if (fstatvfs (fd, &buf) == -1)
-#else
- struct statfs buf;
- if (fstatfs (fd, &buf) == -1)
-#endif
- raise_constant(*(value *)caml_named_value("error"));
- bufv = copy_statfs (&buf);
- CAMLreturn (bufv);
-#else
- raise_constant(*(value *)caml_named_value("not supported"));
-#endif
-}
-
int glibc_version(void)
{
CAMLparam0 ();