summaryrefslogtreecommitdiffstats
path: root/libc/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps')
-rw-r--r--libc/sysdeps/linux/common/gethstnm.c37
-rw-r--r--libc/sysdeps/linux/mips/__syscall_error.c18
-rw-r--r--libc/sysdeps/linux/mips/clone.S1
-rw-r--r--libc/sysdeps/linux/mips/sys/asm.h15
4 files changed, 34 insertions, 37 deletions
diff --git a/libc/sysdeps/linux/common/gethstnm.c b/libc/sysdeps/linux/common/gethstnm.c
deleted file mode 100644
index fc5a72c8d..000000000
--- a/libc/sysdeps/linux/common/gethstnm.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
- *
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
- */
-
-#include <string.h>
-#include <unistd.h>
-#include <sys/utsname.h>
-#include <errno.h>
-
-libc_hidden_proto(gethostname)
-
-libc_hidden_proto(strlen)
-libc_hidden_proto(strcpy)
-libc_hidden_proto(uname)
-
-int
-gethostname(char *name, size_t len)
-{
- struct utsname uts;
-
- if (name == NULL) {
- __set_errno(EINVAL);
- return -1;
- }
-
- if (uname(&uts) == -1) return -1;
-
- if (strlen(uts.nodename)+1 > len) {
- __set_errno(EINVAL);
- return -1;
- }
- strcpy(name, uts.nodename);
- return 0;
-}
-libc_hidden_def(gethostname)
diff --git a/libc/sysdeps/linux/mips/__syscall_error.c b/libc/sysdeps/linux/mips/__syscall_error.c
new file mode 100644
index 000000000..5e109a83b
--- /dev/null
+++ b/libc/sysdeps/linux/mips/__syscall_error.c
@@ -0,0 +1,18 @@
+/* Wrapper for setting errno.
+ *
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <errno.h>
+#include <features.h>
+
+/* This routine is jumped to by all the syscall handlers, to stash
+ * an error number into errno. */
+int __syscall_error(int err_no) attribute_hidden;
+int __syscall_error(int err_no)
+{
+ __set_errno(err_no);
+ return -1;
+}
diff --git a/libc/sysdeps/linux/mips/clone.S b/libc/sysdeps/linux/mips/clone.S
index 716cd993f..03162db43 100644
--- a/libc/sysdeps/linux/mips/clone.S
+++ b/libc/sysdeps/linux/mips/clone.S
@@ -125,3 +125,4 @@ __thread_start:
move a0,v0
jal HIDDEN_JUMPTARGET(_exit)
.end __thread_start
+weak_alias(clone, __clone)
diff --git a/libc/sysdeps/linux/mips/sys/asm.h b/libc/sysdeps/linux/mips/sys/asm.h
index 76f6af3e1..4c8bd9cb2 100644
--- a/libc/sysdeps/linux/mips/sys/asm.h
+++ b/libc/sysdeps/linux/mips/sys/asm.h
@@ -469,5 +469,20 @@ symbol = value
# define MFC0 dmfc0
# define MTC0 dmtc0
#endif
+/* The MIPS archtectures do not have a uniform memory model. Particular
+ platforms may provide additional guarantees - for instance, the R4000
+ LL and SC instructions implicitly perform a SYNC, and the 4K promises
+ strong ordering.
+
+ However, in the absence of those guarantees, we must assume weak ordering
+ and SYNC explicitly where necessary.
+
+ Some obsolete MIPS processors may not support the SYNC instruction. This
+ applies to "true" MIPS I processors; most of the processors which compile
+ using MIPS I implement parts of MIPS II. */
+
+#ifndef MIPS_SYNC
+# define MIPS_SYNC sync
+#endif
#endif /* sys/asm.h */