aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-02-27 19:02:25 -0800
committerH. Peter Anvin <hpa@zytor.com>2007-02-27 19:02:25 -0800
commit20720dcd78c8530e86a340a5b6aa8894fefdba88 (patch)
tree81051b99a0dae6309c25443d7ecda7b9f051b05e
parent15e050acd2fe598f70b86d3c376dabd7e3d46028 (diff)
downloadklibc-20720dcd78c8530e86a340a5b6aa8894fefdba88.tar.gz
[klibc] Undo breakage caused by kernel header changes.klibc-1.4.35
The kernel headers have hidden a bunch of stuff that used to be exported. Compensate. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--usr/include/arch/mips/klibc/archconfig.h3
-rw-r--r--usr/include/arch/mips/klibc/archsocket.h17
-rw-r--r--usr/include/arch/mips64/klibc/archconfig.h3
-rw-r--r--usr/include/arch/mips64/klibc/archsocket.h17
-rw-r--r--usr/include/klibc/sysconfig.h11
-rw-r--r--usr/include/netinet/in.h4
-rw-r--r--usr/include/sys/socket.h10
-rw-r--r--usr/include/sys/stat.h47
-rw-r--r--usr/klibc/inet/inet_ntop.c1
9 files changed, 107 insertions, 6 deletions
diff --git a/usr/include/arch/mips/klibc/archconfig.h b/usr/include/arch/mips/klibc/archconfig.h
index 15b3208cdb7cb..ff0afb5453173 100644
--- a/usr/include/arch/mips/klibc/archconfig.h
+++ b/usr/include/arch/mips/klibc/archconfig.h
@@ -15,4 +15,7 @@
/* MIPS defines it's own statfs */
#define _KLIBC_STATFS_F_TYPE_32B 1
+/* MIPS has nonstandard socket definitions */
+#define _KLIBC_HAS_ARCHSOCKET_H 1
+
#endif /* _KLIBC_ARCHCONFIG_H */
diff --git a/usr/include/arch/mips/klibc/archsocket.h b/usr/include/arch/mips/klibc/archsocket.h
new file mode 100644
index 0000000000000..d6daf1b6af2de
--- /dev/null
+++ b/usr/include/arch/mips/klibc/archsocket.h
@@ -0,0 +1,17 @@
+/*
+ * arch/mips/klibc/archsocket.h
+ */
+
+#ifndef _KLIBC_ARCHSOCKET_H
+#define _KLIBC_ARCHSOCKET_H
+
+#ifndef SOCK_STREAM
+# define SOCK_DGRAM 1
+# define SOCK_STREAM 2
+# define SOCK_RAW 3
+# define SOCK_RDM 4
+# define SOCK_SEQPACKET 5
+# define SOCK_PACKET 10
+#endif
+
+#endif /* _KLIBC_ARCHSOCKET_H */
diff --git a/usr/include/arch/mips64/klibc/archconfig.h b/usr/include/arch/mips64/klibc/archconfig.h
index b440af1818775..9071cb48b626e 100644
--- a/usr/include/arch/mips64/klibc/archconfig.h
+++ b/usr/include/arch/mips64/klibc/archconfig.h
@@ -9,6 +9,7 @@
#ifndef _KLIBC_ARCHCONFIG_H
#define _KLIBC_ARCHCONFIG_H
-/* All defaults */
+/* MIPS has nonstandard socket definitions */
+#define _KLIBC_HAS_ARCHSOCKET_H 1
#endif /* _KLIBC_ARCHCONFIG_H */
diff --git a/usr/include/arch/mips64/klibc/archsocket.h b/usr/include/arch/mips64/klibc/archsocket.h
new file mode 100644
index 0000000000000..6c3947d155249
--- /dev/null
+++ b/usr/include/arch/mips64/klibc/archsocket.h
@@ -0,0 +1,17 @@
+/*
+ * arch/mips64/klibc/archsocket.h
+ */
+
+#ifndef _KLIBC_ARCHSOCKET_H
+#define _KLIBC_ARCHSOCKET_H
+
+#ifndef SOCK_STREAM
+# define SOCK_DGRAM 1
+# define SOCK_STREAM 2
+# define SOCK_RAW 3
+# define SOCK_RDM 4
+# define SOCK_SEQPACKET 5
+# define SOCK_PACKET 10
+#endif
+
+#endif /* _KLIBC_ARCHSOCKET_H */
diff --git a/usr/include/klibc/sysconfig.h b/usr/include/klibc/sysconfig.h
index f4fb7a944a0df..9c132d93dcbf8 100644
--- a/usr/include/klibc/sysconfig.h
+++ b/usr/include/klibc/sysconfig.h
@@ -163,6 +163,7 @@
# define _KLIBC_STATFS_F_TYPE_64 (_BITSIZE == 64)
#endif
+
/*
* _KLIBC_STATFS_F_TYPE_32B:
*
@@ -173,4 +174,14 @@
# define _KLIBC_STATFS_F_TYPE_32B 0
#endif
+
+/*
+ * _KLIBC_HAS_ARCHSOCKET_H
+ *
+ * This architecture has <klibc/archsocket.h>
+ */
+#ifndef _KLIBC_HAS_ARCHSOCKET_H
+# define _KLIBC_HAS_ARCHSOCKET_H 0
+#endif
+
#endif /* _KLIBC_SYSCONFIG_H */
diff --git a/usr/include/netinet/in.h b/usr/include/netinet/in.h
index 4ab7c240714ab..2952bb2a8bafb 100644
--- a/usr/include/netinet/in.h
+++ b/usr/include/netinet/in.h
@@ -5,12 +5,10 @@
#ifndef _NETINET_IN_H
#define _NETINET_IN_H
-/* added this include by Mats Petersson */
-#include <linux/socket.h>
-
#include <klibc/extern.h>
#include <stdint.h>
#include <endian.h> /* Must be included *before* <linux/in.h> */
+#include <sys/socket.h> /* Must be included *before* <linux/in.h> */
#include <linux/in.h>
#ifndef htons
diff --git a/usr/include/sys/socket.h b/usr/include/sys/socket.h
index 2de1d6acc1acc..7d47087072ada 100644
--- a/usr/include/sys/socket.h
+++ b/usr/include/sys/socket.h
@@ -7,9 +7,17 @@
#include <klibc/extern.h>
#include <klibc/compiler.h>
+#include <klibc/sysconfig.h>
#include <linux/socket.h>
+#if _KLIBC_HAS_ARCHSOCKET_H
+#include <klibc/archsocket.h>
+#endif
-/* For some reason these may be protected by __KERNEL__ in asm/socket.h */
+/* Great job, guys! These are *architecture-specific* ABI constants,
+ that are hidden under #ifdef __KERNEL__... what a brilliant idea!
+ These are the "common" definitions; if not appropriate, override
+ them in <klibc/archsocket.h>. */
+
#ifndef SOCK_STREAM
# define SOCK_STREAM 1
# define SOCK_DGRAM 2
diff --git a/usr/include/sys/stat.h b/usr/include/sys/stat.h
index 3226133006b13..33182fca28dd8 100644
--- a/usr/include/sys/stat.h
+++ b/usr/include/sys/stat.h
@@ -9,7 +9,52 @@
#include <sys/types.h>
#include <sys/time.h> /* For struct timespec */
#include <klibc/archstat.h>
-#include <linux/stat.h>
+
+/* 2.6.21 kernels have once again hidden a bunch of stuff... */
+#ifndef S_IFMT
+
+#define S_IFMT 00170000
+#define S_IFSOCK 0140000
+#define S_IFLNK 0120000
+#define S_IFREG 0100000
+#define S_IFBLK 0060000
+#define S_IFDIR 0040000
+#define S_IFCHR 0020000
+#define S_IFIFO 0010000
+#define S_ISUID 0004000
+#define S_ISGID 0002000
+#define S_ISVTX 0001000
+
+#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
+#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
+#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
+#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
+#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
+#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
+
+#define S_IRWXU 00700
+#define S_IRUSR 00400
+#define S_IWUSR 00200
+#define S_IXUSR 00100
+
+#define S_IRWXG 00070
+#define S_IRGRP 00040
+#define S_IWGRP 00020
+#define S_IXGRP 00010
+
+#define S_IRWXO 00007
+#define S_IROTH 00004
+#define S_IWOTH 00002
+#define S_IXOTH 00001
+
+#define S_IRWXUGO (S_IRWXU|S_IRWXG|S_IRWXO)
+#define S_IALLUGO (S_ISUID|S_ISGID|S_ISVTX|S_IRWXUGO)
+#define S_IRUGO (S_IRUSR|S_IRGRP|S_IROTH)
+#define S_IWUGO (S_IWUSR|S_IWGRP|S_IWOTH)
+#define S_IXUGO (S_IXUSR|S_IXGRP|S_IXOTH)
+
+#endif
#ifdef _STATBUF_ST_NSEC
/* struct stat has struct timespec instead of time_t */
diff --git a/usr/klibc/inet/inet_ntop.c b/usr/klibc/inet/inet_ntop.c
index ef31a186b320c..106fb45a0ebe5 100644
--- a/usr/klibc/inet/inet_ntop.c
+++ b/usr/klibc/inet/inet_ntop.c
@@ -5,6 +5,7 @@
#include <stdio.h>
#include <string.h>
#include <errno.h>
+#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in6.h>