klibc: rework socket.h.patch for v. 1.5.15+1.5.16. Fix ugly c&p bug.
authorAndrea Adami <andrea.adami@gmail.com>
Sun, 30 May 2010 21:41:53 +0000 (23:41 +0200)
committerAndrea Adami <andrea.adami@gmail.com>
Sun, 30 May 2010 21:43:15 +0000 (23:43 +0200)
recipes/klibc/klibc-1.5.15+1.5.16/socket.h.patch
recipes/klibc/klibc_1.5.15+1.5.16.inc

index 016fadb..8532b01 100644 (file)
@@ -13,27 +13,33 @@ linux-2.6 9c501935a3cdcf6b1d35aaee3aa11c7a7051a305 cleaned
 thus define the stuff that used to be there in klibc socket.h
 
 Signed-off-by: maximilian attems <max@stro.at>
----
 
-diff --git a/usr/include/sys/socket.h b/usr/include/sys/socket.h
-index 7d47087..a6357d1 100644
---- a/usr/include/sys/socket.h
-+++ b/usr/include/sys/socket.h
-@@ -9,6 +9,9 @@
+Modified for compatibility with pre 2.6.33 kernels in OpenEmbedded
+---
+Index: klibc-1.5.15/usr/include/sys/socket.h
+===================================================================
+--- a/usr/include/sys/socket.h 2009-01-04 20:28:03.000000000 +0100
++++ b/usr/include/sys/socket.h 2010-05-30 23:12:40.000000000 +0200
+@@ -9,6 +9,14 @@
  #include <klibc/compiler.h>
  #include <klibc/sysconfig.h>
  #include <linux/socket.h>
++
++#include <linux/version.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
 +#include <linux/sockios.h>            /* the SIOCxxx I/O controls     */
 +#include <linux/uio.h>                        /* iovec support                */
 +#include <asm/socket.h>                       /* arch-dependent defines       */
++#endif
++
  #if _KLIBC_HAS_ARCHSOCKET_H
  #include <klibc/archsocket.h>
  #endif
-@@ -27,6 +30,40 @@
+@@ -27,6 +35,41 @@
  # define SOCK_PACKET    10
  #endif
  
-+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
 +typedef unsigned short        sa_family_t;
 +
 +struct sockaddr {
@@ -66,72 +72,98 @@ index 7d47087..a6357d1 100644
 +
 +/* Flags we can use with send/ and recv. */
 +#define MSG_PEEK      2
++#endif
 +
  typedef int socklen_t;
  
  __extern int socket(int, int, int);
-diff --git a/usr/kinit/nfsmount/nfsmount.h b/usr/kinit/nfsmount/nfsmount.h
-index 6d958bc..59c20cb 100644
---- a/usr/kinit/nfsmount/nfsmount.h
-+++ b/usr/kinit/nfsmount/nfsmount.h
-@@ -3,6 +3,9 @@
+Index: klibc-1.5.15/usr/kinit/nfsmount/nfsmount.h
+===================================================================
+--- a/usr/kinit/nfsmount/nfsmount.h    2009-01-04 20:28:03.000000000 +0100
++++ b/usr/kinit/nfsmount/nfsmount.h    2010-05-30 23:00:36.000000000 +0200
+@@ -3,6 +3,12 @@
  
  #include <linux/nfs_mount.h>
  
++#include <linux/version.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
 +#define MNTPROC_MNT            1
 +#define MNTPROC_UMNT           3
++#endif
 +
  extern int nfs_port;
  
  extern int nfsmount_main(int argc, char *argv[]);
-diff --git a/usr/kinit/nfsmount/dummypmap.c b/usr/kinit/nfsmount/dummypmap.c
-index 43abe37..481e23b 100644
---- a/usr/kinit/nfsmount/dummypmap.c
-+++ b/usr/kinit/nfsmount/dummypmap.c
-@@ -39,7 +39,7 @@ struct portmap_reply {
+Index: klibc-1.5.15/usr/kinit/nfsmount/dummypmap.c
+===================================================================
+--- a/usr/kinit/nfsmount/dummypmap.c   2009-01-04 20:28:03.000000000 +0100
++++ b/usr/kinit/nfsmount/dummypmap.c   2010-05-30 23:08:29.000000000 +0200
+@@ -39,7 +39,12 @@
  
  static int bind_portmap(void)
  {
--      int sock = socket(PF_INET, SOCK_DGRAM, 0);
++#include <linux/version.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
 +      int sock = socket(AF_INET, SOCK_DGRAM, 0);
++#else
+       int sock = socket(PF_INET, SOCK_DGRAM, 0);
++#endif
        struct sockaddr_in sin;
  
        if (sock < 0)
-diff --git a/usr/kinit/nfsmount/mount.c b/usr/kinit/nfsmount/mount.c
-index a55af91..f18cffa 100644
---- a/usr/kinit/nfsmount/mount.c
-+++ b/usr/kinit/nfsmount/mount.c
-@@ -290,9 +290,9 @@ int nfs_mount(const char *pathname, const char *hostname,
+Index: klibc-1.5.15/usr/kinit/nfsmount/mount.c
+===================================================================
+--- a/usr/kinit/nfsmount/mount.c       2010-05-30 22:30:26.000000000 +0200
++++ b/usr/kinit/nfsmount/mount.c       2010-05-30 23:13:15.000000000 +0200
+@@ -294,11 +294,21 @@
+       }
        mounted = 1;
  
-       if (data->flags & NFS_MOUNT_TCP) {
--              sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
++#include <linux/version.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
++      if (data->flags & NFS_MOUNT_TCP) {
 +              sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
-       } else {
--              sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
++      } else {
 +              sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
++      }
++#else
+       if (data->flags & NFS_MOUNT_TCP) {
+               sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
+       } else {
+               sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
        }
++#endif
++
  
        if (sock == -1) {
-diff --git a/usr/kinit/nfsmount/sunrpc.c b/usr/kinit/nfsmount/sunrpc.c
-index 6607cf7..6fb81a1 100644
---- a/usr/kinit/nfsmount/sunrpc.c
-+++ b/usr/kinit/nfsmount/sunrpc.c
-@@ -152,7 +152,7 @@ struct client *tcp_client(uint32_t server, uint16_t port, uint32_t flags)
+               perror("socket");
+Index: klibc-1.5.15/usr/kinit/nfsmount/sunrpc.c
+===================================================================
+--- a/usr/kinit/nfsmount/sunrpc.c      2009-01-04 20:28:03.000000000 +0100
++++ b/usr/kinit/nfsmount/sunrpc.c      2010-05-30 23:11:12.000000000 +0200
+@@ -152,7 +152,12 @@
  
        memset(clnt, 0, sizeof(clnt));
  
--      if ((sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) {
++#include <linux/version.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
 +      if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) {
++#else
+       if ((sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) {
++#endif
                perror("socket");
                goto bail;
        }
-@@ -197,7 +197,7 @@ struct client *udp_client(uint32_t server, uint16_t port, uint32_t flags)
+@@ -197,7 +202,12 @@
  
        memset(clnt, 0, sizeof(clnt));
  
--      if ((sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) {
++#include <linux/version.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
 +      if ((sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) {
++#else
+       if ((sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) {
++#endif
                perror("socket");
                goto bail;
        }
index 630ee45..2f32d8a 100644 (file)
@@ -1,4 +1,5 @@
 require klibc-common.inc
+inherit linux-kernel-base
 
 # temporary override here in the recipe
 # until 1.5.16 is released
@@ -16,10 +17,9 @@ SRC_URI += "file://fstype-sane-vfat-and-jffs2-for-1.5.patch \
             file://klibc_kexecsyscall.patch \
             file://mntproc-definitions.patch \
             file://signal-cleanup.patch \
+            file://socket.h.patch \
             file://isystem.patch \
             "
-# upstream in 2.6.33
-SRC_URI += '${@base_version_less_or_equal("PV", "2.6.32", "", "file://socket.h.patch", d)}'
 
 S = "${WORKDIR}/klibc-1.5.15"