From: Justin Cinkelj <justin.cink...@xlab.si>
Committer: Nadav Har'El <n...@scylladb.com>
Branch: master

libc: add functions required for libpython2.7.so

When we try to reuse python from the build system (instead of
compiling it from source), libpython2.7.so requires additional
libc/glibc symbols. It seems that (at least for most trivial python
programs) those functions are not really called and can be implemented
as stubs. The patch was prepared on Fedora 25.

Signed-off-by: Justin Cinkelj <justin.cink...@xlab.si>
Message-Id: <20170801161142.31048-1-justin.cink...@xlab.si>

---
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -1328,6 +1328,9 @@ libc += misc/mntent.o
 musl += misc/nftw.o
 libc += misc/__longjmp_chk.o

+musl += signal/killpg.o
+musl += signal/siginterrupt.o
+
 musl += multibyte/btowc.o
 musl += multibyte/internal.o
 musl += multibyte/mblen.o
@@ -1396,6 +1399,7 @@ libc += process/execle.o
 musl += process/execv.o
 musl += process/execl.o
 libc += process/waitpid.o
+musl += process/wait.o

 libc += arch/$(arch)/setjmp/setjmp.o
 libc += arch/$(arch)/setjmp/longjmp.o
@@ -1677,6 +1681,9 @@ libc += unistd/getsid.o
 libc += unistd/setsid.o
 libc += unistd/ttyname_r.o
 libc += unistd/ttyname.o
+musl += unistd/tcgetpgrp.o
+musl += unistd/tcsetpgrp.o
+musl += unistd/setpgrp.o

 musl += regex/fnmatch.o
 musl += regex/glob.o
diff --git a/runtime.cc b/runtime.cc
--- a/runtime.cc
+++ b/runtime.cc
@@ -554,3 +554,73 @@ int sysctl(int *, int, void *, size_t *, void *, size_t)
     errno = ENOTDIR;
     return -1;
 }
+
+extern "C"
+char *tmpnam_r(char *s)
+{
+    return s ? tmpnam(s) : NULL;
+}
+
+extern "C"
+pid_t wait3(int *status, int options, struct rusage *usage)
+{
+    WARN_STUBBED();
+    errno = ECHILD;
+    return -1;
+}
+
+extern "C"
+pid_t wait4(pid_t pid, int *status, int options, struct rusage *usage)
+{
+    WARN_STUBBED();
+    errno = ECHILD;
+    return -1;
+}
+
+int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid)
+{
+    WARN_STUBBED();
+    errno = ENOSYS;
+    return -1;
+}
+
+int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid)
+{
+    WARN_STUBBED();
+    errno = ENOSYS;
+    return -1;
+}
+
+extern "C"
+int openpty(int *amaster, int *aslave, char *name,
+           const struct termios *termp,
+           const struct winsize *winp)
+{
+    WARN_STUBBED();
+    errno = ENOENT;
+    return -1;
+}
+
+extern "C"
+pid_t forkpty(int *amaster, char *name,
+             const struct termios *termp,
+             const struct winsize *winp)
+{
+    WARN_STUBBED();
+    errno = ENOENT;
+    return -1;
+}
+
+int nice(int inc)
+{
+    return setpriority(PRIO_PROCESS, 0, getpriority(PRIO_PROCESS, 0)+inc);
+}
+
+char *ctermid(char *s)
+{
+    static char s2[L_ctermid];
+    WARN_STUBBED();
+    if (!s) s = s2;
+    *s = 0;
+    return s;
+}

--
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to