aboutsummaryrefslogtreecommitdiffstats
path: root/tools/squashfs4/patches/120-cygwin_fixes.patch
blob: 79469a9eaab08ea6b3c8a6bb4899b6a03ecbfd7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
--- a/squashfs-tools/global.h
+++ b/squashfs-tools/global.h
@@ -44,6 +44,11 @@ typedef long long squashfs_fragment_inde
 typedef squashfs_inode_t squashfs_inode;
 typedef squashfs_block_t squashfs_block;
 
+#ifdef __CYGWIN__
+#include <sys/termios.h>
+#define FNM_EXTMATCH  (1 << 5)
+#endif
+
 #ifndef FNM_EXTMATCH
 #define FNM_EXTMATCH 0
 #endif
--- a/squashfs-tools/mksquashfs.c
+++ b/squashfs-tools/mksquashfs.c
@@ -49,10 +49,12 @@
 #include <sys/wait.h>
 
 #ifndef linux
+#ifndef __CYGWIN__
 #define __BYTE_ORDER BYTE_ORDER
 #define __BIG_ENDIAN BIG_ENDIAN
 #define __LITTLE_ENDIAN LITTLE_ENDIAN
 #include <sys/sysctl.h>
+#endif /* __CYGWIN__ */
 #else
 #include <endian.h>
 #include <sys/sysinfo.h>
@@ -817,6 +819,7 @@ void sigusr1_handler()
 
 void sigwinch_handler()
 {
+#ifndef __CYGWIN__
 	struct winsize winsize;
 
 	if(ioctl(1, TIOCGWINSZ, &winsize) == -1) {
@@ -826,6 +829,9 @@ void sigwinch_handler()
 		columns = 80;
 	} else
 		columns = winsize.ws_col;
+#else
+	columns = 80;
+#endif
 }
 
 
@@ -3853,7 +3859,9 @@ void initialise_threads()
 		BAD_ERROR("Failed to set signal mask in intialise_threads\n");
 
 	signal(SIGUSR1, sigusr1_handler);
-
+#ifdef __CYGWIN__
+	processors = atoi(getenv("NUMBER_OF_PROCESSORS"));
+#else
 	if(processors == -1) {
 #ifndef linux
 		int mib[2];
@@ -3875,6 +3883,7 @@ void initialise_threads()
 		processors = get_nprocs();
 #endif
 	}
+#endif /* __CYGWIN__ */
 
 	if((thread = malloc((2 + processors * 2) * sizeof(pthread_t))) == NULL)
 		BAD_ERROR("Out of memory allocating thread descriptors\n");
--- a/squashfs-tools/read_fs.c
+++ b/squashfs-tools/read_fs.c
@@ -39,9 +39,11 @@ extern unsigned int get_guid(unsigned in
 #include <sys/mman.h>
 
 #ifndef linux
+#ifndef __CYGWIN__
 #define __BYTE_ORDER BYTE_ORDER
 #define __BIG_ENDIAN BIG_ENDIAN
 #define __LITTLE_ENDIAN LITTLE_ENDIAN
+#endif
 #else
 #include <endian.h>
 #endif
--- a/squashfs-tools/swap.c
+++ b/squashfs-tools/swap.c
@@ -20,9 +20,11 @@
  */
 
 #ifndef linux
+#ifndef __CYGWIN__
 #define __BYTE_ORDER BYTE_ORDER
 #define __BIG_ENDIAN BIG_ENDIAN
 #define __LITTLE_ENDIAN LITTLE_ENDIAN
+#endif
 #else
 #include <endian.h>
 #endif
--- a/squashfs-tools/unsquashfs.c
+++ b/squashfs-tools/unsquashfs.c
@@ -112,6 +112,7 @@ void update_progress_bar();
 
 void sigwinch_handler()
 {
+#ifndef __CYGWIN__
 	struct winsize winsize;
 
 	if(ioctl(1, TIOCGWINSZ, &winsize) == -1) {
@@ -121,6 +122,9 @@ void sigwinch_handler()
 		columns = 80;
 	} else
 		columns = winsize.ws_col;
+#else
+	columns = 80;
+#endif
 }
 
 
@@ -1787,7 +1791,9 @@ void initialise_threads(int fragment_buf
 	if(sigprocmask(SIG_BLOCK, &sigmask, &old_mask) == -1)
 		EXIT_UNSQUASH("Failed to set signal mask in intialise_threads"
 			"\n");
-
+#ifdef __CYGWIN__
+	processors = atoi(getenv("NUMBER_OF_PROCESSORS"));
+#else
 	if(processors == -1) {
 #ifndef linux
 		int mib[2];
@@ -1809,6 +1815,7 @@ void initialise_threads(int fragment_buf
 		processors = get_nprocs();
 #endif
 	}
+#endif /* __CYGWIN__ */
 
 	if((thread = malloc((3 + processors) * sizeof(pthread_t))) == NULL)
 		EXIT_UNSQUASH("Out of memory allocating thread descriptors\n");
--- a/squashfs-tools/unsquashfs.h
+++ b/squashfs-tools/unsquashfs.h
@@ -45,10 +45,12 @@
 #include <sys/time.h>
 
 #ifndef linux
+#ifndef __CYGWIN__
 #define __BYTE_ORDER BYTE_ORDER
 #define __BIG_ENDIAN BIG_ENDIAN
 #define __LITTLE_ENDIAN LITTLE_ENDIAN
 #include <sys/sysctl.h>
+#endif /* __CYGWIN__ */
 #else
 #include <endian.h>
 #include <sys/sysinfo.h>