[T106][ZXW-22]7520V3SCV2.01.01.02P42U09_VEC_V0.8_AP_VEC origin source commit
Change-Id: Ic6e05d89ecd62fc34f82b23dcf306c93764aec4b
diff --git a/ap/build/uClibc/libc/misc/statfs/Makefile b/ap/build/uClibc/libc/misc/statfs/Makefile
new file mode 100644
index 0000000..4a8f4a0
--- /dev/null
+++ b/ap/build/uClibc/libc/misc/statfs/Makefile
@@ -0,0 +1,13 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+top_srcdir=../../../
+top_builddir=../../../
+all: objs
+include $(top_builddir)Rules.mak
+include Makefile.in
+include $(top_srcdir)Makerules
diff --git a/ap/build/uClibc/libc/misc/statfs/Makefile.in b/ap/build/uClibc/libc/misc/statfs/Makefile.in
new file mode 100644
index 0000000..aa92d1f
--- /dev/null
+++ b/ap/build/uClibc/libc/misc/statfs/Makefile.in
@@ -0,0 +1,31 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000-2008 Erik Andersen <andersen@uclibc.org>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+subdirs += libc/misc/statfs
+
+CSRC := statvfs.c fstatvfs.c
+ifeq ($(UCLIBC_HAS_LFS),y)
+ifeq ($(UCLIBC_LINUX_SPECIFIC),y)
+CSRC += fstatfs64.c statfs64.c
+endif
+CSRC += statvfs64.c fstatvfs64.c
+endif
+
+MISC_STATFS_DIR := $(top_srcdir)libc/misc/statfs
+MISC_STATFS_OUT := $(top_builddir)libc/misc/statfs
+
+MISC_STATFS_SRC := $(patsubst %.c,$(MISC_STATFS_DIR)/%.c,$(CSRC))
+MISC_STATFS_OBJ := $(patsubst %.c,$(MISC_STATFS_OUT)/%.o,$(CSRC))
+
+libc-y += $(MISC_STATFS_OBJ)
+
+libc-nomulti-$(UCLIBC_HAS_LFS) += $(MISC_STATFS_OUT)/statvfs64.o $(MISC_STATFS_OUT)/fstatvfs64.o
+
+objclean-y += CLEAN_libc/misc/statfs
+
+CLEAN_libc/misc/statfs:
+ $(do_rm) $(addprefix $(MISC_STATFS_OUT)/*., o os oS)
diff --git a/ap/build/uClibc/libc/misc/statfs/fstatfs64.c b/ap/build/uClibc/libc/misc/statfs/fstatfs64.c
new file mode 100644
index 0000000..27bb8d6
--- /dev/null
+++ b/ap/build/uClibc/libc/misc/statfs/fstatfs64.c
@@ -0,0 +1,51 @@
+/* Return information about the filesystem on which FD resides.
+ Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <_lfs_64.h>
+
+#include <errno.h>
+#include <string.h>
+#include <sys/statfs.h>
+#include <sys/statvfs.h>
+#include <stddef.h>
+
+extern __typeof(fstatfs) __libc_fstatfs;
+
+/* Return information about the filesystem on which FD resides. */
+int fstatfs64 (int fd, struct statfs64 *buf)
+{
+ struct statfs buf32;
+
+ if (__libc_fstatfs (fd, &buf32) < 0)
+ return -1;
+
+ buf->f_type = buf32.f_type;
+ buf->f_bsize = buf32.f_bsize;
+ buf->f_blocks = buf32.f_blocks;
+ buf->f_bfree = buf32.f_bfree;
+ buf->f_bavail = buf32.f_bavail;
+ buf->f_files = buf32.f_files;
+ buf->f_ffree = buf32.f_ffree;
+ buf->f_fsid = buf32.f_fsid;
+ buf->f_namelen = buf32.f_namelen;
+ memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare));
+
+ return 0;
+}
+libc_hidden_def(fstatfs64)
diff --git a/ap/build/uClibc/libc/misc/statfs/fstatvfs.c b/ap/build/uClibc/libc/misc/statfs/fstatvfs.c
new file mode 100644
index 0000000..63fce0f
--- /dev/null
+++ b/ap/build/uClibc/libc/misc/statfs/fstatvfs.c
@@ -0,0 +1,60 @@
+/* Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <features.h>
+#include <errno.h>
+#include <mntent.h>
+#include <paths.h>
+#include <string.h>
+#include <sys/mount.h>
+#include <sys/stat.h>
+#include <sys/statfs.h>
+#include <sys/statvfs.h>
+
+
+#ifndef __USE_FILE_OFFSET64
+extern int fstatfs (int __fildes, struct statfs *__buf)
+ __THROW __nonnull ((2));
+#else
+# ifdef __REDIRECT_NTH
+extern int __REDIRECT_NTH (fstatfs, (int __fildes, struct statfs *__buf),
+ fstatfs64) __nonnull ((2));
+# else
+# define fstatfs fstatfs64
+# endif
+#endif
+
+extern __typeof(fstatfs) __libc_fstatfs;
+
+int fstatvfs (int fd, struct statvfs *buf)
+{
+ struct statfs fsbuf;
+ struct stat st;
+
+ /* Get as much information as possible from the system. */
+ if (__libc_fstatfs (fd, &fsbuf) < 0)
+ return -1;
+
+#define STAT(st) fstat (fd, st)
+#include "internal_statvfs.c"
+
+ /* We signal success if the statfs call succeeded. */
+ return 0;
+}
+libc_hidden_def(fstatvfs)
diff --git a/ap/build/uClibc/libc/misc/statfs/fstatvfs64.c b/ap/build/uClibc/libc/misc/statfs/fstatvfs64.c
new file mode 100644
index 0000000..f57e9d9
--- /dev/null
+++ b/ap/build/uClibc/libc/misc/statfs/fstatvfs64.c
@@ -0,0 +1,68 @@
+/* Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <_lfs_64.h>
+
+#include <errno.h>
+#include <mntent.h>
+#include <paths.h>
+#include <string.h>
+#include <sys/mount.h>
+#include <sys/stat.h>
+#include <sys/statfs.h>
+#include <sys/statvfs.h>
+
+
+#undef stat
+#define stat stat64
+
+int fstatvfs64 (int fd, struct statvfs64 *buf)
+{
+ struct statfs64 fsbuf;
+ struct stat64 st;
+#if !defined __UCLIBC_LINUX_SPECIFIC__
+ int ret;
+ struct statvfs buf32;
+
+ ret = fstatvfs (fd, &buf32);
+ if (ret == 0) {
+ fsbuf.f_bsize = buf32.f_bsize;
+ fsbuf.f_frsize = buf32.f_frsize;
+ fsbuf.f_blocks = buf32.f_blocks;
+ fsbuf.f_bfree = buf32.f_bfree;
+ fsbuf.f_bavail = buf32.f_bavail;
+ fsbuf.f_files = buf32.f_files;
+ fsbuf.f_ffree = buf32.f_ffree;
+ if (sizeof (fsbuf.f_fsid) == sizeof(buf32.f_fsid))
+ memcpy (&fsbuf.f_fsid, &buf32.f_fsid, sizeof(fsbuf.f_fsid));
+ /* and if not, then you could approximate or whatever.. */
+ fsbuf.f_namelen = buf32.f_namemax;
+ } else
+ return ret;
+#else
+ /* Get as much information as possible from the system. */
+ if (fstatfs64 (fd, &fsbuf) < 0)
+ return -1;
+#endif
+#define STAT(st) fstat64 (fd, st)
+#include "internal_statvfs.c"
+
+ /* We signal success if the statfs call succeeded. */
+ return 0;
+}
diff --git a/ap/build/uClibc/libc/misc/statfs/internal_statvfs.c b/ap/build/uClibc/libc/misc/statfs/internal_statvfs.c
new file mode 100644
index 0000000..6075e9c
--- /dev/null
+++ b/ap/build/uClibc/libc/misc/statfs/internal_statvfs.c
@@ -0,0 +1,111 @@
+/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+ /* Now fill in the fields we have information for. */
+ buf->f_bsize = fsbuf.f_bsize;
+ /* Linux does not support f_frsize, so set it to the full block size. */
+ buf->f_frsize = fsbuf.f_bsize;
+ buf->f_blocks = fsbuf.f_blocks;
+ buf->f_bfree = fsbuf.f_bfree;
+ buf->f_bavail = fsbuf.f_bavail;
+ buf->f_files = fsbuf.f_files;
+ buf->f_ffree = fsbuf.f_ffree;
+ if (sizeof (buf->f_fsid) == sizeof (fsbuf.f_fsid))
+ buf->f_fsid = (fsbuf.f_fsid.__val[0]
+ | ((unsigned long int) fsbuf.f_fsid.__val[1]
+ << (8 * (sizeof (buf->f_fsid)
+ - sizeof (fsbuf.f_fsid.__val[0])))));
+ else
+ /* We cannot help here. The statvfs element is not large enough to
+ contain both words of the statfs f_fsid field. */
+ buf->f_fsid = fsbuf.f_fsid.__val[0];
+#ifdef _STATVFSBUF_F_UNUSED
+ buf->__f_unused = 0;
+#endif
+ buf->f_namemax = fsbuf.f_namelen;
+ memset (buf->__f_spare, '\0', 6 * sizeof (int));
+
+ /* What remains to do is to fill the fields f_favail and f_flag. */
+
+ /* XXX I have no idea how to compute f_favail. Any idea??? */
+ buf->f_favail = buf->f_ffree;
+
+ /* Determining the flags is tricky. We have to read /proc/mounts or
+ the /etc/mtab file and search for the entry which matches the given
+ file. The way we can test for matching filesystem is using the
+ device number. */
+ buf->f_flag = 0;
+ if (STAT (&st) >= 0)
+ {
+ int save_errno = errno;
+ struct mntent mntbuf;
+ FILE *mtab;
+
+ mtab = setmntent ("/proc/mounts", "r");
+ if (mtab == NULL)
+ mtab = setmntent (_PATH_MOUNTED, "r");
+
+ if (mtab != NULL)
+ {
+ char tmpbuf[1024];
+
+ while (getmntent_r (mtab, &mntbuf, tmpbuf, sizeof (tmpbuf)))
+ {
+ struct stat fsst;
+
+ /* Find out about the device the current entry is for. */
+ if (stat (mntbuf.mnt_dir, &fsst) >= 0
+ && st.st_dev == fsst.st_dev)
+ {
+ /* Bingo, we found the entry for the device FD is on.
+ Now interpret the option string. */
+ char *cp = mntbuf.mnt_opts;
+ char *opt;
+
+ while ((opt = strsep (&cp, ",")) != NULL)
+ if (strcmp (opt, "ro") == 0)
+ buf->f_flag |= ST_RDONLY;
+ else if (strcmp (opt, "nosuid") == 0)
+ buf->f_flag |= ST_NOSUID;
+#ifdef __USE_GNU
+ else if (strcmp (opt, "noexec") == 0)
+ buf->f_flag |= ST_NOEXEC;
+ else if (strcmp (opt, "nodev") == 0)
+ buf->f_flag |= ST_NODEV;
+ else if (strcmp (opt, "sync") == 0)
+ buf->f_flag |= ST_SYNCHRONOUS;
+ else if (strcmp (opt, "mand") == 0)
+ buf->f_flag |= ST_MANDLOCK;
+ else if (strcmp (opt, "noatime") == 0)
+ buf->f_flag |= ST_NOATIME;
+ else if (strcmp (opt, "nodiratime") == 0)
+ buf->f_flag |= ST_NODIRATIME;
+#endif
+
+ /* We can stop looking for more entries. */
+ break;
+ }
+ }
+
+ /* Close the file. */
+ endmntent (mtab);
+ }
+
+ __set_errno (save_errno);
+ }
diff --git a/ap/build/uClibc/libc/misc/statfs/statfs64.c b/ap/build/uClibc/libc/misc/statfs/statfs64.c
new file mode 100644
index 0000000..0cc8595
--- /dev/null
+++ b/ap/build/uClibc/libc/misc/statfs/statfs64.c
@@ -0,0 +1,49 @@
+/* Return information about the filesystem on which FILE resides.
+ Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <_lfs_64.h>
+
+#include <string.h>
+#include <stddef.h>
+#include <sys/statfs.h>
+
+extern __typeof(statfs) __libc_statfs;
+
+/* Return information about the filesystem on which FILE resides. */
+int statfs64 (const char *file, struct statfs64 *buf)
+{
+ struct statfs buf32;
+
+ if (__libc_statfs (file, &buf32) < 0)
+ return -1;
+
+ buf->f_type = buf32.f_type;
+ buf->f_bsize = buf32.f_bsize;
+ buf->f_blocks = buf32.f_blocks;
+ buf->f_bfree = buf32.f_bfree;
+ buf->f_bavail = buf32.f_bavail;
+ buf->f_files = buf32.f_files;
+ buf->f_ffree = buf32.f_ffree;
+ buf->f_fsid = buf32.f_fsid;
+ buf->f_namelen = buf32.f_namelen;
+ memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare));
+
+ return 0;
+}
+libc_hidden_def(statfs64)
diff --git a/ap/build/uClibc/libc/misc/statfs/statvfs.c b/ap/build/uClibc/libc/misc/statfs/statvfs.c
new file mode 100644
index 0000000..5ac38ed
--- /dev/null
+++ b/ap/build/uClibc/libc/misc/statfs/statvfs.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 1998, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <features.h>
+#include <errno.h>
+#include <mntent.h>
+#include <paths.h>
+#include <string.h>
+#include <sys/mount.h>
+#include <sys/stat.h>
+#include <sys/statfs.h>
+#include <sys/statvfs.h>
+
+
+extern __typeof(statfs) __libc_statfs;
+
+int statvfs (const char *file, struct statvfs *buf)
+{
+ struct statfs fsbuf;
+ struct stat st;
+
+ /* Get as much information as possible from the system. */
+ if (__libc_statfs (file, &fsbuf) < 0)
+ return -1;
+
+#define STAT(st) stat (file, st)
+#include "internal_statvfs.c"
+
+ /* We signal success if the statfs call succeeded. */
+ return 0;
+}
+libc_hidden_def(statvfs)
diff --git a/ap/build/uClibc/libc/misc/statfs/statvfs64.c b/ap/build/uClibc/libc/misc/statfs/statvfs64.c
new file mode 100644
index 0000000..9923e66
--- /dev/null
+++ b/ap/build/uClibc/libc/misc/statfs/statvfs64.c
@@ -0,0 +1,68 @@
+/* Copyright (C) 1998, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <_lfs_64.h>
+
+#include <errno.h>
+#include <mntent.h>
+#include <paths.h>
+#include <string.h>
+#include <sys/mount.h>
+#include <sys/stat.h>
+#include <sys/statfs.h>
+#include <sys/statvfs.h>
+
+
+#undef stat
+#define stat stat64
+
+int statvfs64 (const char *file, struct statvfs64 *buf)
+{
+ struct statfs64 fsbuf;
+ struct stat64 st;
+#if !defined __UCLIBC_LINUX_SPECIFIC__
+ int ret;
+ struct statvfs buf32;
+
+ ret = statvfs (file, &buf32);
+ if (ret == 0) {
+ fsbuf.f_bsize = buf32.f_bsize;
+ fsbuf.f_frsize = buf32.f_frsize;
+ fsbuf.f_blocks = buf32.f_blocks;
+ fsbuf.f_bfree = buf32.f_bfree;
+ fsbuf.f_bavail = buf32.f_bavail;
+ fsbuf.f_files = buf32.f_files;
+ fsbuf.f_ffree = buf32.f_ffree;
+ if (sizeof (fsbuf.f_fsid) == sizeof(buf32.f_fsid))
+ memcpy (&fsbuf.f_fsid, &buf32.f_fsid, sizeof(fsbuf.f_fsid));
+ /* and if not, then you could approximate or whatever.. */
+ fsbuf.f_namelen = buf32.f_namemax;
+ } else
+ return ret;
+#else
+ /* Get as much information as possible from the system. */
+ if (statfs64 (file, &fsbuf) < 0)
+ return -1;
+#endif
+#define STAT(st) stat (file, st)
+#include "internal_statvfs.c"
+
+ /* We signal success if the statfs call succeeded. */
+ return 0;
+}