kernel: add a new version of my netfilter speedup patches for linux 2.6.39 and 3.0
[openwrt.git] / target / linux / generic / patches-3.0 / 210-darwin_scripts_include.patch
1 --- a/scripts/kallsyms.c
2 +++ b/scripts/kallsyms.c
3 @@ -22,6 +22,35 @@
4 #include <stdlib.h>
5 #include <string.h>
6 #include <ctype.h>
7 +#ifdef __APPLE__
8 +/* Darwin has no memmem implementation, this one is ripped of the uClibc-0.9.28 source */
9 +void *memmem (const void *haystack, size_t haystack_len,
10 + const void *needle, size_t needle_len)
11 +{
12 + const char *begin;
13 + const char *const last_possible
14 + = (const char *) haystack + haystack_len - needle_len;
15 +
16 + if (needle_len == 0)
17 + /* The first occurrence of the empty string is deemed to occur at
18 + the beginning of the string. */
19 + return (void *) haystack;
20 +
21 + /* Sanity check, otherwise the loop might search through the whole
22 + memory. */
23 + if (__builtin_expect (haystack_len < needle_len, 0))
24 + return NULL;
25 +
26 + for (begin = (const char *) haystack; begin <= last_possible; ++begin)
27 + if (begin[0] == ((const char *) needle)[0] &&
28 + !memcmp ((const void *) &begin[1],
29 + (const void *) ((const char *) needle + 1),
30 + needle_len - 1))
31 + return (void *) begin;
32 +
33 + return NULL;
34 +}
35 +#endif
36
37 #ifndef ARRAY_SIZE
38 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
39 --- a/scripts/kconfig/Makefile
40 +++ b/scripts/kconfig/Makefile
41 @@ -148,6 +148,9 @@ check-lxdialog := $(srctree)/$(src)/lxd
42 # we really need to do so. (Do not call gcc as part of make mrproper)
43 HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) \
44 -DLOCALE
45 +ifeq ($(shell uname -s),Darwin)
46 +HOST_LOADLIBES += -lncurses
47 +endif
48
49 # ===========================================================================
50 # Shared Makefile for the various kconfig executables:
51 --- a/scripts/mod/mk_elfconfig.c
52 +++ b/scripts/mod/mk_elfconfig.c
53 @@ -1,7 +1,11 @@
54 #include <stdio.h>
55 #include <stdlib.h>
56 #include <string.h>
57 +#ifndef __APPLE__
58 #include <elf.h>
59 +#else
60 +#include "../../../../../tools/sstrip/include/elf.h"
61 +#endif
62
63 int
64 main(int argc, char **argv)
65 --- a/scripts/mod/modpost.h
66 +++ b/scripts/mod/modpost.h
67 @@ -7,7 +7,11 @@
68 #include <sys/mman.h>
69 #include <fcntl.h>
70 #include <unistd.h>
71 +#if !(defined(__APPLE__) || defined(__CYGWIN__))
72 #include <elf.h>
73 +#else
74 +#include "../../../../../tools/sstrip/include/elf.h"
75 +#endif
76
77 #include "elfconfig.h"
78
This page took 0.059766 seconds and 5 git commands to generate.