]> xenbits.xensource.com Git - unikraft/libs/newlib.git/commitdiff
Add missing stubs needed by CPython2
authorVlad-Andrei BĂDOIU (78692) <vlad_andrei.badoiu@stud.acs.upb.ro>
Sun, 2 Jun 2019 16:13:16 +0000 (16:13 +0000)
committerFelipe Huici <felipe.huici@neclab.eu>
Sun, 2 Jun 2019 21:57:17 +0000 (23:57 +0200)
This patch adds a number of stubs needed by CPython2 to compile.

Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@stud.acs.upb.ro>
Reviewed-by: Costin Lupu <costin.lupu@cs.pub.ro>
console.c
file.c
process.c
pty.c
resource.c

index 4fd33cd804d8eed376ff6694981c32e82c24db52..7016957ff394eb01f25b3685b32ccfccf6823ac5 100644 (file)
--- a/console.c
+++ b/console.c
@@ -41,3 +41,13 @@ int isatty(int file __unused)
 {
        return 1;
 }
+
+char *ttyname(int fd __unused)
+{
+       return 0;
+}
+
+char *ctermid(char *s __unused)
+{
+       return 0;
+}
diff --git a/file.c b/file.c
index ab1cdbe3365c316aa94636dfe340bf660b525d70..3fdf99a8c1f4dc453ca3c6fa829f098f2c50903f 100644 (file)
--- a/file.c
+++ b/file.c
@@ -94,3 +94,26 @@ int select(int nfds, fd_set *readfds __unused, fd_set *writefds __unused,
        return -1;
 }
 #endif /* !CONFIG_LWIP_SOCKET */
+
+int fchown(int fd __unused, uid_t owner __unused, gid_t group __unused)
+{
+       return 0;
+}
+
+int lchown(const char *pathname __unused, uid_t owner __unused,
+               gid_t group __unused)
+{
+       return 0;
+}
+
+
+int utimes(const char *filename __unused,
+               const struct timeval times[2] __unused)
+{
+       return 0;
+}
+
+int pipe(int pipefd[2] __unused)
+{
+       return 0;
+}
index 096a12bad68d4c0d567b9de1b8b441324e6ca38b..c4e366420eb4a5d7c08676447fdc889655a5d105 100644 (file)
--- a/process.c
+++ b/process.c
@@ -37,6 +37,9 @@
 
 #include <time.h>
 #include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/resource.h>
 #undef errno
 extern int errno;
 
@@ -46,6 +49,26 @@ int execve(char *name __unused, char **argv __unused, char **env __unused)
        return -1;
 }
 
+int execv(const char *path __unused, char *const argv[] __unused)
+{
+       return 0;
+}
+
+int system(const char *command __unused)
+{
+       return 0;
+}
+
+FILE *popen(const char *command __unused, const char *type __unused)
+{
+       return NULL;
+}
+
+int pclose(FILE *stream __unused)
+{
+       return 0;
+}
+
 int fork(void)
 {
        errno = EAGAIN;
@@ -57,6 +80,11 @@ int getpid(void)
        return 1;
 }
 
+pid_t getppid(void)
+{
+       return 0;
+}
+
 int kill(int pid __unused, int sig __unused)
 {
        errno = EINVAL;
@@ -73,3 +101,68 @@ int wait(int *status __unused)
        errno = ECHILD;
        return -1;
 }
+
+int setpgrp(void)
+{
+       return 0;
+}
+
+
+int killpg(int pgrp __unused, int sig __unused)
+{
+       return 0;
+}
+
+
+pid_t wait3(int *wstatus __unused, int options __unused,
+               struct rusage *rusage __unused)
+{
+       return 0;
+}
+
+pid_t wait4(pid_t pid __unused, int *wstatus __unused, int options __unused,
+               struct rusage *rusage __unused)
+{
+       return 0;
+}
+
+pid_t waitpid(pid_t pid __unused, int *wstatus __unused, int options __unused)
+{
+       return 0;
+}
+
+pid_t setsid(void)
+{
+       return 0;
+}
+
+pid_t getsid(pid_t pid __unused)
+{
+       return 0;
+}
+
+int setpgid(pid_t pid __unused, pid_t pgid __unused)
+{
+       return 0;
+}
+
+pid_t getpgid(pid_t pid)
+{
+       return 0;
+}
+
+
+int tcsetpgrp(int fd __unused, pid_t pgrp __unused)
+{
+       return 0;
+}
+
+pid_t tcgetpgrp(int fd __unused)
+{
+       return 0;
+}
+
+int nice(int inc __unused)
+{
+       return 0;
+}
diff --git a/pty.c b/pty.c
index 46b554ae5b3bdef344086b5b6a9d4f158e40bfa7..009688d2327f4918cbe006ede6fb10d7d383352b 100644 (file)
--- a/pty.c
+++ b/pty.c
@@ -36,6 +36,7 @@
  */
 
 #include <pty.h>
+#include <sys/types.h>
 #include <uk/essentials.h>
 
 int openpty(int *amaster __unused, int *aslave __unused, char *name __unused,
@@ -44,3 +45,10 @@ int openpty(int *amaster __unused, int *aslave __unused, char *name __unused,
 {
        return 0;
 }
+
+pid_t forkpty(int *amaster __unused, char *name __unused,
+               const struct termios *termp __unused,
+               const struct winsize *winp __unused)
+{
+       return 0;
+}
index ae112f2d05a4b5ead3c35ff5850f696803ada088..30d0028757ac974588532c2bdae7f220fe56687e 100644 (file)
@@ -46,3 +46,8 @@ int setrlimit(int resource __unused, const struct rlimit *rlim __unused)
 {
        return 0;
 }
+
+int getrusage(int who __unused, struct rusage *usage __unused)
+{
+       return 0;
+}