[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT/MUSL PATCH V2 05/28] Remove files related to syscalls management



In this patch, we remove patches, source and header files that are
obsolete with the syscall shim layer. These old files were added at
the time where the syscall shim layer was not implemented.

Signed-off-by: Gaulthier Gain <gaulthier.gain@xxxxxxxxx>
---
 Makefile.uk                              |   1 -
 include/syscall.h                        | 238 -----------------------
 patches/0001-prevent-local-syscall.patch |  13 --
 patches/0003-prevent-local-syscall.patch |  21 --
 syscall.c                                | 144 --------------
 5 files changed, 417 deletions(-)
 delete mode 100644 include/syscall.h
 delete mode 100644 patches/0001-prevent-local-syscall.patch
 delete mode 100644 patches/0003-prevent-local-syscall.patch
 delete mode 100644 syscall.c

diff --git a/Makefile.uk b/Makefile.uk
index 2620f6a..81746dc 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -122,7 +122,6 @@ CXXFLAGS += $(LIBMUSL_HEADER_FLAGS-y)
 # OS dependencies code - Glue between Unicore and musl
 
################################################################################
 LIBMUSL_SRCS-y += $(LIBMUSL_BASE)/mem.c
-LIBMUSL_SRCS-y += $(LIBMUSL_BASE)/syscall.c
 
 
################################################################################
 # musl code -- one external Makefile per sub-lib
diff --git a/include/syscall.h b/include/syscall.h
deleted file mode 100644
index a6d921d..0000000
--- a/include/syscall.h
+++ /dev/null
@@ -1,238 +0,0 @@
-#ifndef UK_MUSL_SYSCALL
-#define UK_MUSL_SYSCALL
-
-#include <sys/syscall.h>
-
-#define __SYSCALL_LL_E(x) (x)
-#define __SYSCALL_LL_O(x) (x)
-
-#ifndef SYSCALL_RLIM_INFINITY
-#define SYSCALL_RLIM_INFINITY (~0ULL)
-#endif
-
-#ifndef SYSCALL_MMAP2_UNIT
-#define SYSCALL_MMAP2_UNIT 4096ULL
-#endif
-
-#ifndef __SYSCALL_LL_PRW
-#define __SYSCALL_LL_PRW(x) __SYSCALL_LL_O(x)
-#endif
-
-#ifndef __scc
-#define __scc(X) ((long) (X))
-typedef long syscall_arg_t;
-#endif
-
-__attribute__((visibility("hidden")))
-long __syscall_ret(unsigned long), __syscall(syscall_arg_t, ...),
-       __syscall_cp(syscall_arg_t, syscall_arg_t, syscall_arg_t, syscall_arg_t,
-                    syscall_arg_t, syscall_arg_t, syscall_arg_t);
-
-long syscall(long n, ...);
-long __syscall(long n, ...);
-long __syscall0(long n);
-long __syscall1(long n, long a1);
-long __syscall2(long n, long a1, long a2);
-long __syscall3(long n, long a1, long a2, long a3);
-long __syscall4(long n, long a1, long a2, long a3, long a4);
-long __syscall5(long n, long a1, long a2, long a3, long a4, long a5);
-long __syscall6(long n, long a1, long a2, long a3, long a4, long a5, long a6);
-
-#define __SYSCALL_NARGS_X(a,b,c,d,e,f,g,h,n,...) n
-#define __SYSCALL_NARGS(...) __SYSCALL_NARGS_X(__VA_ARGS__,7,6,5,4,3,2,1,0,)
-#define __SYSCALL_CONCAT_X(a,b) a##b
-#define __SYSCALL_CONCAT(a,b) __SYSCALL_CONCAT_X(a,b)
-#define __SYSCALL_DISP(b,...) 
__SYSCALL_CONCAT(b,__SYSCALL_NARGS(__VA_ARGS__))(__VA_ARGS__)
-
-#define socketcall __socketcall
-#define socketcall_cp __socketcall_cp
-
-#define __syscall_cp0(n) (__syscall_cp)(n,0,0,0,0,0,0)
-#define __syscall_cp1(n,a) (__syscall_cp)(n,__scc(a),0,0,0,0,0)
-#define __syscall_cp2(n,a,b) (__syscall_cp)(n,__scc(a),__scc(b),0,0,0,0)
-#define __syscall_cp3(n,a,b,c) 
(__syscall_cp)(n,__scc(a),__scc(b),__scc(c),0,0,0)
-#define __syscall_cp4(n,a,b,c,d) 
(__syscall_cp)(n,__scc(a),__scc(b),__scc(c),__scc(d),0,0)
-#define __syscall_cp5(n,a,b,c,d,e) 
(__syscall_cp)(n,__scc(a),__scc(b),__scc(c),__scc(d),__scc(e),0)
-#define __syscall_cp6(n,a,b,c,d,e,f) 
(__syscall_cp)(n,__scc(a),__scc(b),__scc(c),__scc(d),__scc(e),__scc(f))
-
-#define __syscall_cp(...) __SYSCALL_DISP(__syscall_cp,__VA_ARGS__)
-#define syscall_cp(...) __syscall_ret(__syscall_cp(__VA_ARGS__))
-
-#ifndef SYSCALL_USE_SOCKETCALL
-#define __socketcall(nm,a,b,c,d,e,f) syscall(SYS_##nm, a, b, c, d, e, f)
-#define __socketcall_cp(nm,a,b,c,d,e,f) syscall_cp(SYS_##nm, a, b, c, d, e, f)
-#else
-#define __socketcall(nm,a,b,c,d,e,f) syscall(SYS_socketcall, __SC_##nm, \
-    ((long [6]){ (long)a, (long)b, (long)c, (long)d, (long)e, (long)f }))
-#define __socketcall_cp(nm,a,b,c,d,e,f) syscall_cp(SYS_socketcall, __SC_##nm, \
-    ((long [6]){ (long)a, (long)b, (long)c, (long)d, (long)e, (long)f }))
-#endif
-
-/* fixup legacy 16-bit junk */
-
-#ifdef SYS_getuid32
-#undef SYS_lchown
-#undef SYS_getuid
-#undef SYS_getgid
-#undef SYS_geteuid
-#undef SYS_getegid
-#undef SYS_setreuid
-#undef SYS_setregid
-#undef SYS_getgroups
-#undef SYS_setgroups
-#undef SYS_fchown
-#undef SYS_setresuid
-#undef SYS_getresuid
-#undef SYS_setresgid
-#undef SYS_getresgid
-#undef SYS_chown
-#undef SYS_setuid
-#undef SYS_setgid
-#undef SYS_setfsuid
-#undef SYS_setfsgid
-#define SYS_lchown SYS_lchown32
-#define SYS_getuid SYS_getuid32
-#define SYS_getgid SYS_getgid32
-#define SYS_geteuid SYS_geteuid32
-#define SYS_getegid SYS_getegid32
-#define SYS_setreuid SYS_setreuid32
-#define SYS_setregid SYS_setregid32
-#define SYS_getgroups SYS_getgroups32
-#define SYS_setgroups SYS_setgroups32
-#define SYS_fchown SYS_fchown32
-#define SYS_setresuid SYS_setresuid32
-#define SYS_getresuid SYS_getresuid32
-#define SYS_setresgid SYS_setresgid32
-#define SYS_getresgid SYS_getresgid32
-#define SYS_chown SYS_chown32
-#define SYS_setuid SYS_setuid32
-#define SYS_setgid SYS_setgid32
-#define SYS_setfsuid SYS_setfsuid32
-#define SYS_setfsgid SYS_setfsgid32
-#endif
-
-
-/* fixup legacy 32-bit-vs-lfs64 junk */
-
-#ifdef SYS_fcntl64
-#undef SYS_fcntl
-#define SYS_fcntl SYS_fcntl64
-#endif
-
-#ifdef SYS_getdents64
-#undef SYS_getdents
-#define SYS_getdents SYS_getdents64
-#endif
-
-#ifdef SYS_ftruncate64
-#undef SYS_ftruncate
-#undef SYS_truncate
-#define SYS_ftruncate SYS_ftruncate64
-#define SYS_truncate SYS_truncate64
-#endif
-
-#ifdef SYS_stat64
-#undef SYS_stat
-#define SYS_stat SYS_stat64
-#endif
-
-#ifdef SYS_fstat64
-#undef SYS_fstat
-#define SYS_fstat SYS_fstat64
-#endif
-
-#ifdef SYS_lstat64
-#undef SYS_lstat
-#define SYS_lstat SYS_lstat64
-#endif
-
-#ifdef SYS_statfs64
-#undef SYS_statfs
-#define SYS_statfs SYS_statfs64
-#endif
-
-#ifdef SYS_fstatfs64
-#undef SYS_fstatfs
-#define SYS_fstatfs SYS_fstatfs64
-#endif
-
-#if defined(SYS_newfstatat)
-#undef SYS_fstatat
-#define SYS_fstatat SYS_newfstatat
-#elif defined(SYS_fstatat64)
-#undef SYS_fstatat
-#define SYS_fstatat SYS_fstatat64
-#endif
-
-#ifdef SYS_ugetrlimit
-#undef SYS_getrlimit
-#define SYS_getrlimit SYS_ugetrlimit
-#endif
-
-#ifdef SYS__newselect
-#undef SYS_select
-#define SYS_select SYS__newselect
-#endif
-
-#ifdef SYS_pread64
-#undef SYS_pread
-#undef SYS_pwrite
-#define SYS_pread SYS_pread64
-#define SYS_pwrite SYS_pwrite64
-#endif
-
-#ifdef SYS_fadvise64_64
-#undef SYS_fadvise
-#define SYS_fadvise SYS_fadvise64_64
-#elif defined(SYS_fadvise64)
-#undef SYS_fadvise
-#define SYS_fadvise SYS_fadvise64
-#endif
-
-#ifdef SYS_sendfile64
-#undef SYS_sendfile
-#define SYS_sendfile SYS_sendfile64
-#endif
-
-/* socketcall calls */
-
-#define __SC_socket      1
-#define __SC_bind        2
-#define __SC_connect     3
-#define __SC_listen      4
-#define __SC_accept      5
-#define __SC_getsockname 6
-#define __SC_getpeername 7
-#define __SC_socketpair  8
-#define __SC_send        9
-#define __SC_recv        10
-#define __SC_sendto      11
-#define __SC_recvfrom    12
-#define __SC_shutdown    13
-#define __SC_setsockopt  14
-#define __SC_getsockopt  15
-#define __SC_sendmsg     16
-#define __SC_recvmsg     17
-#define __SC_accept4     18
-#define __SC_recvmmsg    19
-#define __SC_sendmmsg    20
-
-#ifdef SYS_open
-#define __sys_open2(x,pn,fl) __syscall2(SYS_open, pn, (fl)|O_LARGEFILE)
-#define __sys_open3(x,pn,fl,mo) __syscall3(SYS_open, pn, (fl)|O_LARGEFILE, mo)
-#define __sys_open_cp2(x,pn,fl) __syscall_cp2(SYS_open, pn, (fl)|O_LARGEFILE)
-#define __sys_open_cp3(x,pn,fl,mo) __syscall_cp3(SYS_open, pn, 
(fl)|O_LARGEFILE, mo)
-#else
-#define __sys_open2(x,pn,fl) __syscall3(SYS_openat, AT_FDCWD, pn, 
(fl)|O_LARGEFILE)
-#define __sys_open3(x,pn,fl,mo) __syscall4(SYS_openat, AT_FDCWD, pn, 
(fl)|O_LARGEFILE, mo)
-#define __sys_open_cp2(x,pn,fl) __syscall_cp3(SYS_openat, AT_FDCWD, pn, 
(fl)|O_LARGEFILE)
-#define __sys_open_cp3(x,pn,fl,mo) __syscall_cp4(SYS_openat, AT_FDCWD, pn, 
(fl)|O_LARGEFILE, mo)
-#endif
-
-#define __sys_open(...) __SYSCALL_DISP(__sys_open,,__VA_ARGS__)
-#define sys_open(...) __syscall_ret(__sys_open(__VA_ARGS__))
-
-#define __sys_open_cp(...) __SYSCALL_DISP(__sys_open_cp,,__VA_ARGS__)
-#define sys_open_cp(...) __syscall_ret(__sys_open_cp(__VA_ARGS__))
-
-#endif
diff --git a/patches/0001-prevent-local-syscall.patch 
b/patches/0001-prevent-local-syscall.patch
deleted file mode 100644
index 902b060..0000000
--- a/patches/0001-prevent-local-syscall.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/src/internal/stdio_impl.h b/src/internal/stdio_impl.h
-index 1127a492..116cd333 100644
---- a/src/internal/stdio_impl.h
-+++ b/src/internal/stdio_impl.h
-@@ -2,7 +2,7 @@
- #define _STDIO_IMPL_H
- 
- #include <stdio.h>
--#include "syscall.h"
-+#include <syscall.h>
- #include "libc.h"
- 
- #define UNGET 8
diff --git a/patches/0003-prevent-local-syscall.patch 
b/patches/0003-prevent-local-syscall.patch
deleted file mode 100644
index 775f51b..0000000
--- a/patches/0003-prevent-local-syscall.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-commit 68ff1e40eecfb4f2d6b9961cc0b78dc4b30f320b
-Author: Felipe Huici <felipe.huici@xxxxxxxxx>
-Date:   Wed Sep 5 15:23:22 2018 +0200
-
-    prevent file from using syscall.h in local directory
-    
-    Signed-off-by: Felipe Huici <felipe.huici@xxxxxxxxx>
-
-diff --git a/src/internal/pthread_impl.h b/src/internal/pthread_impl.h
-index 3826bd8e..478e298e 100644
---- a/src/internal/pthread_impl.h
-+++ b/src/internal/pthread_impl.h
-@@ -6,7 +6,7 @@
- #include <errno.h>
- #include <limits.h>
- #include "libc.h"
--#include "syscall.h"
-+#include <syscall.h>
- #include "atomic.h"
- #include "futex.h"
- 
diff --git a/syscall.c b/syscall.c
deleted file mode 100644
index 668ee04..0000000
--- a/syscall.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause */
-/*
- * Authors: Felipe Huici <felipe.huici@xxxxxxxxx>
- *
- * Copyright (c) 2017, 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.
- */
-
-#include "syscall.h"
-#include <errno.h>
-#include <stdarg.h>
-#include <uk/print.h>
-#include <bits/ioctl.h>
-
-long __syscall0(long n)
-{
-  return __syscall(n);
-}
-
-long __syscall1(long n, long a1)
-{
-  return __syscall(n, a1);
-}
-
-long __syscall2(long n, long a1, long a2)
-{
-  return __syscall(n, a1, a2);
-}
-
-long __syscall3(long n, long a1, long a2, long a3)
-{
-  return __syscall(n, a1, a2, a3);
-}
-
-long __syscall4(long n, long a1, long a2, long a3, long a4)
-{
-  return __syscall(n, a1, a2, a3, a4);  
-}
-
-long __syscall5(long n, long a1, long a2, long a3, long a4, long a5)
-{
-  return __syscall(n, a1, a2, a3, a4, a5);  
-}
-
-long __syscall6(long n, long a1, long a2, long a3, long a4, long a5, long a6)
-{
-  return __syscall(n, a1, a2, a3, a4, a5, a6);  
-}
-
-
-long __do_syscall(long n, va_list args)
-{
-  switch(n)
-  {
-    case SYS_ioctl:
-    {
-      int fd = va_arg(args, int);      
-      unsigned long request = va_arg(args, unsigned long);
-         
-      switch(request)
-      {
-        case TIOCGWINSZ:
-        {
-          struct winsize *ws = va_arg(args, struct winsize *);
-         /* Set some reasonable values */
-         ws->ws_row = 200;
-         ws->ws_col = 80;        
-         return 0;
-        }
-        default:
-        {
-         uk_printd(DLVL_EXTRA, "unknown or unimplemented ioctl! %ld\n", 
request);
-          return -1;
-        }
-      }
-
-      
-    case SYS_writev:
-    {
-      int fd = va_arg(args, int);      
-      struct iovec *iov = va_arg(args, struct iovec *);
-      int iovcnt = va_arg(args, int);
-      return uk_syscall_writev(fd, iov, iovcnt);
-    }
-      
-    default:
-    {
-      uk_printd(DLVL_EXTRA, "unknown or unimplemented syscall! %ld\n", n);
-      return -1;
-    }
-  }
-  
-  //  errno = ENOSYS;
-  return -1;
-  }
-}
-
-long syscall(long n, ...)
-{
-  long ret;
-  va_list args;
-  va_start(args, n);
-  ret = __do_syscall(n, args);
-  va_end(args);
-
-  return ret;
-}
-
-long __syscall(long n, ...)
-{
-  long ret;
-  va_list args;
-  va_start(args, n);
-  ret = __do_syscall(n, args);
-  va_end(args);
-
-  return ret;
-}
-- 
2.20.1


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.