squashfs4: add missing include for freebsd (patch from #9842)
[openwrt.git] / tools / squashfs4 / patches / 120-cygwin_fixes.patch
1 --- a/squashfs-tools/mksquashfs.c
2 +++ b/squashfs-tools/mksquashfs.c
3 @@ -51,15 +51,22 @@
4 #include <sys/wait.h>
5
6 #ifndef linux
7 +#ifndef __CYGWIN__
8 #define __BYTE_ORDER BYTE_ORDER
9 #define __BIG_ENDIAN BIG_ENDIAN
10 #define __LITTLE_ENDIAN LITTLE_ENDIAN
11 #include <sys/sysctl.h>
12 +#endif /* __CYGWIN__ */
13 #else
14 #include <endian.h>
15 #include <sys/sysinfo.h>
16 #endif
17
18 +#ifdef __CYGWIN__
19 +#include <sys/termios.h>
20 +#define FNM_EXTMATCH (1 << 5)
21 +#endif
22 +
23 #ifndef FNM_EXTMATCH
24 #define FNM_EXTMATCH 0
25 #endif
26 @@ -844,6 +851,7 @@ void sigusr1_handler()
27
28 void sigwinch_handler()
29 {
30 +#ifndef __CYGWIN__
31 struct winsize winsize;
32
33 if(ioctl(1, TIOCGWINSZ, &winsize) == -1) {
34 @@ -853,6 +861,9 @@ void sigwinch_handler()
35 columns = 80;
36 } else
37 columns = winsize.ws_col;
38 +#else
39 + columns = 80;
40 +#endif
41 }
42
43
44 @@ -4066,6 +4077,9 @@ void initialise_threads(int readb_mbytes
45
46 signal(SIGUSR1, sigusr1_handler);
47
48 +#ifdef __CYGWIN__
49 + processors = atoi(getenv("NUMBER_OF_PROCESSORS"));
50 +#else
51 if(processors == -1) {
52 #ifndef linux
53 int mib[2];
54 @@ -4087,6 +4101,7 @@ void initialise_threads(int readb_mbytes
55 processors = sysconf(_SC_NPROCESSORS_ONLN);
56 #endif
57 }
58 +#endif /* __CYGWIN__ */
59
60 thread = malloc((2 + processors * 2) * sizeof(pthread_t));
61 if(thread == NULL)
62 --- a/squashfs-tools/read_fs.c
63 +++ b/squashfs-tools/read_fs.c
64 @@ -33,9 +33,11 @@
65 #include <sys/mman.h>
66
67 #ifndef linux
68 +#ifndef __CYGWIN__
69 #define __BYTE_ORDER BYTE_ORDER
70 #define __BIG_ENDIAN BIG_ENDIAN
71 #define __LITTLE_ENDIAN LITTLE_ENDIAN
72 +#endif
73 #else
74 #include <endian.h>
75 #endif
76 --- a/squashfs-tools/swap.c
77 +++ b/squashfs-tools/swap.c
78 @@ -20,9 +20,11 @@
79 */
80
81 #ifndef linux
82 +#ifndef __CYGWIN__
83 #define __BYTE_ORDER BYTE_ORDER
84 #define __BIG_ENDIAN BIG_ENDIAN
85 #define __LITTLE_ENDIAN LITTLE_ENDIAN
86 +#endif
87 #else
88 #include <endian.h>
89 #endif
90 --- a/squashfs-tools/unsquashfs.c
91 +++ b/squashfs-tools/unsquashfs.c
92 @@ -117,6 +117,7 @@ void update_progress_bar();
93
94 void sigwinch_handler()
95 {
96 +#ifndef __CYGWIN__
97 struct winsize winsize;
98
99 if(ioctl(1, TIOCGWINSZ, &winsize) == -1) {
100 @@ -126,6 +127,9 @@ void sigwinch_handler()
101 columns = 80;
102 } else
103 columns = winsize.ws_col;
104 +#else
105 + columns = 80;
106 +#endif
107 }
108
109
110 @@ -1807,7 +1811,9 @@ void initialise_threads(int fragment_buf
111 if(sigprocmask(SIG_BLOCK, &sigmask, &old_mask) == -1)
112 EXIT_UNSQUASH("Failed to set signal mask in intialise_threads"
113 "\n");
114 -
115 +#ifdef __CYGWIN__
116 + processors = atoi(getenv("NUMBER_OF_PROCESSORS"));
117 +#else
118 if(processors == -1) {
119 #ifndef linux
120 int mib[2];
121 @@ -1829,6 +1835,7 @@ void initialise_threads(int fragment_buf
122 processors = sysconf(_SC_NPROCESSORS_ONLN);
123 #endif
124 }
125 +#endif /* __CYGWIN__ */
126
127 thread = malloc((3 + processors) * sizeof(pthread_t));
128 if(thread == NULL)
129 --- a/squashfs-tools/unsquashfs.h
130 +++ b/squashfs-tools/unsquashfs.h
131 @@ -46,15 +46,22 @@
132 #include <sys/time.h>
133
134 #ifndef linux
135 +#ifndef __CYGWIN__
136 #define __BYTE_ORDER BYTE_ORDER
137 #define __BIG_ENDIAN BIG_ENDIAN
138 #define __LITTLE_ENDIAN LITTLE_ENDIAN
139 #include <sys/sysctl.h>
140 +#endif
141 #else
142 #include <endian.h>
143 #include <sys/sysinfo.h>
144 #endif
145
146 +#ifdef __CYGWIN__
147 +#include <sys/termios.h>
148 +#define FNM_EXTMATCH (1 << 5)
149 +#endif
150 +
151 #ifndef FNM_EXTMATCH
152 #define FNM_EXTMATCH 0
153 #endif
This page took 0.046485 seconds and 5 git commands to generate.