]> xenbits.xensource.com Git - unikraft/libs/newlib.git/commitdiff
update newlib glue for use with vfscore
authorYuri Volchkov <yuri.volchkov@neclab.eu>
Tue, 5 Mar 2019 18:29:54 +0000 (19:29 +0100)
committerFlorian Schmidt <florian.schmidt@neclab.eu>
Wed, 6 Mar 2019 09:35:19 +0000 (10:35 +0100)
Consists of multiple fixes:
  - remove stubs of the functions provided by vfscore
  - import mount.h, statfs.h, uio.h from nolibc (minimal changes)
  - add stub for sigfillset

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Florian Schmidt <florian.schmidt@neclab.eu>
file.c
include/sys/mount.h [new file with mode: 0644]
include/sys/statfs.h [new file with mode: 0644]
include/sys/uio.h [new file with mode: 0644]
plat.c

diff --git a/file.c b/file.c
index 9fd780999c57833df86a4a6b0246b4a8e2d41d2f..05d29b57c63ed10c52268d21b92934034692324e 100644 (file)
--- a/file.c
+++ b/file.c
@@ -45,49 +45,17 @@ extern int errno;
 #define STDOUT_FILENO   1       /* standard output file descriptor */
 #define STDERR_FILENO   2       /* standard error file descriptor */
 
-int open(const char *name __unused, int flags __unused, int mode __unused)
-{
-       return -1;
-}
-
-int fstat(int file __unused, struct stat *st)
-{
-       st->st_mode = S_IFCHR;
-       return 0;
-}
-
-int stat(const char *path __unused, struct stat *buf __unused)
-{
-       return -1;
-}
-
-int mkdir(const char *_path __unused, mode_t __mode __unused)
-{
-       return -1;
-}
-
 int link(char *old __unused, char *new __unused)
 {
        errno = EMLINK;
        return -1;
 }
 
-int unlink(char *name __unused)
-{
-       errno = ENOENT;
-       return -1;
-}
-
 int lseek(int file __unused, int ptr __unused, int dir __unused)
 {
        return 0;
 }
 
-int chmod(const char *pathname __unused, mode_t mode __unused)
-{
-       return 0;
-}
-
 int access(const char *path __unused, int amode __unused)
 {
        return 0;
@@ -138,11 +106,6 @@ long pathconf(const char *path __unused, int name __unused)
        return 0;
 }
 
-int dup2(int oldfd __unused, int newfd __unused)
-{
-       return 0;
-}
-
 #include <sys/mman.h>
 void *mmap(void *addr __unused, size_t len __unused, int prot __unused,
                int flags __unused, int fildes __unused, off_t off __unused)
diff --git a/include/sys/mount.h b/include/sys/mount.h
new file mode 100644 (file)
index 0000000..d7a95b3
--- /dev/null
@@ -0,0 +1,109 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Copyright (C) 2013 Cloudius Systems, Ltd.
+ * Copyright (c) 2019, NEC Europe Ltd., NEC Corporation.
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived from
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
+ */
+
+#ifndef _SYS_MOUNT_H
+#define _SYS_MOUNT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define BLKROSET      _IO(0x12,  93)
+#define BLKROGET      _IO(0x12,  94)
+#define BLKRRPART     _IO(0x12,  95)
+#define BLKGETSIZE    _IO(0x12,  96)
+#define BLKFLSBUF     _IO(0x12,  97)
+#define BLKRASET      _IO(0x12,  98)
+#define BLKRAGET      _IO(0x12,  99)
+#define BLKFRASET     _IO(0x12, 100)
+#define BLKFRAGET     _IO(0x12, 101)
+#define BLKSECTSET    _IO(0x12, 102)
+#define BLKSECTGET    _IO(0x12, 103)
+#define BLKSSZGET     _IO(0x12, 104)
+#define BLKBSZGET    _IOR(0x12, 112, size_t)
+#define BLKBSZSET    _IOW(0x12, 113, size_t)
+#define BLKGETSIZE64 _IOR(0x12, 114, size_t)
+
+#define MS_RDONLY      1
+#define MS_NOSUID      2
+#define MS_NODEV       4
+#define MS_NOEXEC      8
+#define MS_SYNCHRONOUS 16
+#define MS_REMOUNT     32
+#define MS_MANDLOCK    64
+#define MS_DIRSYNC     128
+#define MS_NOATIME     1024
+#define MS_NODIRATIME  2048
+#define MS_BIND        4096
+#define MS_MOVE        8192
+#define MS_REC         16384
+#define MS_SILENT      32768
+#define MS_POSIXACL    (1<<16)
+#define MS_UNBINDABLE  (1<<17)
+#define MS_PRIVATE     (1<<18)
+#define MS_SLAVE       (1<<19)
+#define MS_SHARED      (1<<20)
+#define MS_RELATIME    (1<<21)
+#define MS_KERNMOUNT   (1<<22)
+#define MS_I_VERSION   (1<<23)
+#define MS_STRICTATIME (1<<24)
+#define MS_LAZYTIME    (1<<25)
+#define MS_NOREMOTELOCK (1<<27)
+#define MS_NOSEC       (1<<28)
+#define MS_BORN        (1<<29)
+#define MS_ACTIVE      (1<<30)
+#define MS_NOUSER      (1U<<31)
+
+#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION|MS_LAZYTIME)
+
+#define MS_MGC_VAL 0xc0ed0000
+#define MS_MGC_MSK 0xffff0000
+
+#define MNT_FORCE       1
+#define MNT_DETACH      2
+#define MNT_EXPIRE      4
+#define UMOUNT_NOFOLLOW 8
+
+int mount(const char *dev, const char *dir, const char *fsname,
+         unsigned long flags, const void *data);
+int umount(const char *path);
+int umount2(const char *path, int flags);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/sys/statfs.h b/include/sys/statfs.h
new file mode 100644 (file)
index 0000000..59de629
--- /dev/null
@@ -0,0 +1,36 @@
+#ifndef        _SYS_STATFS_H
+#define        _SYS_STATFS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/statvfs.h>
+
+typedef struct __fsid_t {
+       int __val[2];
+} fsid_t;
+
+struct statfs {
+       unsigned long f_type, f_bsize;
+       fsblkcnt_t f_blocks, f_bfree, f_bavail;
+       fsfilcnt_t f_files, f_ffree;
+       fsid_t f_fsid;
+       unsigned long f_namelen, f_frsize, f_flags, f_spare[4];
+};
+
+int statfs(const char *path, struct statfs *buf);
+int fstatfs(int fd, struct statfs *buf);
+
+#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
+#define statfs64 statfs
+#define fstatfs64 fstatfs
+#define fsblkcnt64_t fsblkcnt_t
+#define fsfilcnt64_t fsfilcnt_t
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/sys/uio.h b/include/sys/uio.h
new file mode 100644 (file)
index 0000000..b83642e
--- /dev/null
@@ -0,0 +1,62 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Copyright (C) 2013 Cloudius Systems, Ltd.
+ * Copyright (c) 2019, NEC Europe Ltd., NEC Corporation.
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived from
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
+ */
+
+#ifndef _SYS_UIO_H
+#define _SYS_UIO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define UIO_MAXIOV 1024
+
+ssize_t readv(int fd, const struct iovec *iov, int iovcnt);
+ssize_t writev(int fd, const struct iovec *iov, int iovcnt);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+ssize_t preadv(int fd, const struct iovec *iov, int iovcnt, off_t offset);
+ssize_t pwritev(int fd, const struct iovec *iov, int iovcnt, off_t offset);
+#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
+#define preadv64 preadv
+#define pwritev64 pwritev
+#define off64_t off_t
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/plat.c b/plat.c
index df07dceb783a6ddc50fb7c13402caf043194e309..f678694acd584a6e8dfc111a6182a04b0aea14c0 100644 (file)
--- a/plat.c
+++ b/plat.c
@@ -55,6 +55,12 @@ int sigprocmask(int how __unused, const sigset_t *set __unused,
        return -1;
 }
 
+int sigfillset(sigset_t *set __unused)
+{
+       errno = ENOTSUP;
+       return -1;
+}
+
 #include <uk/plat/bootstrap.h>
 
 void abort(void)