cd9122 patches/musl/: removes obsolete patches (via Redfoxmoon.)

Authored and Committed by Lucio Andrés Illanes Albornoz 5 years ago
    patches/musl/: removes obsolete patches (via Redfoxmoon.)
    
        
patches/musl/musl-0001-fopencookie.patch DELETED
@@ -1,204 +0,0 @@
1
- From 061843340fbf2493bb615e20e66f60c5d1ef0455 Mon Sep 17 00:00:00 2001
2
- From: William Pitcock <nenolod@dereferenced.org>
3
- Date: Tue, 5 Dec 2017 16:04:43 -0500
4
- Subject: implement the fopencookie extension to stdio
5
-
6
- notes added by maintainer:
7
-
8
- this function is a GNU extension. it was chosen over the similar BSD
9
- function funopen because the latter depends on fpos_t being an
10
- arithmetic type as part of its public API, conflicting with our
11
- definition of fpos_t and with the intent that it be an opaque type. it
12
- was accepted for inclusion because, despite not being widely used, it
13
- is usually very difficult to extricate software using it from the
14
- dependency on it.
15
-
16
- calling pattern for the read and write callbacks is not likely to
17
- match glibc or other implementations, but should work with any
18
- reasonable callbacks. in particular the read function is never called
19
- without at least one byte being needed to satisfy its caller, so that
20
- spurious blocking is not introduced.
21
-
22
- contracts for what callbacks called from inside libc/stdio can do are
23
- always complicated, and at some point still need to be specified
24
- explicitly. at the very least, the callbacks must return or block
25
- indefinitely (they cannot perform nonlocal exits) and they should not
26
- make calls to stdio using their own FILE as an argument.
27
- ---
28
- include/stdio.h | 14 +++++
29
- src/stdio/fopencookie.c | 138 ++++++++++++++++++++++++++++++++++++++++++++++++
30
- 2 files changed, 152 insertions(+)
31
- create mode 100644 src/stdio/fopencookie.c
32
-
33
- diff --git a/include/stdio.h b/include/stdio.h
34
- index 884d2e6..2932c76 100644
35
- --- a/include/stdio.h
36
- +++ b/include/stdio.h
37
- @@ -182,6 +182,20 @@ int vasprintf(char **, const char *, __isoc_va_list);
38
- #ifdef _GNU_SOURCE
39
- char *fgets_unlocked(char *, int, FILE *);
40
- int fputs_unlocked(const char *, FILE *);
41
- +
42
- +typedef ssize_t (cookie_read_function_t)(void *, char *, size_t);
43
- +typedef ssize_t (cookie_write_function_t)(void *, const char *, size_t);
44
- +typedef int (cookie_seek_function_t)(void *, off_t *, int);
45
- +typedef int (cookie_close_function_t)(void *);
46
- +
47
- +typedef struct {
48
- + cookie_read_function_t *read;
49
- + cookie_write_function_t *write;
50
- + cookie_seek_function_t *seek;
51
- + cookie_close_function_t *close;
52
- +} cookie_io_functions_t;
53
- +
54
- +FILE *fopencookie(void *, const char *, cookie_io_functions_t);
55
- #endif
56
-
57
- #if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
58
- diff --git a/src/stdio/fopencookie.c b/src/stdio/fopencookie.c
59
- new file mode 100644
60
- index 0000000..2f46dd5
61
- --- /dev/null
62
- +++ b/src/stdio/fopencookie.c
63
- @@ -0,0 +1,138 @@
64
- +#define _GNU_SOURCE
65
- +#include "stdio_impl.h"
66
- +#include <stdlib.h>
67
- +#include <sys/ioctl.h>
68
- +#include <fcntl.h>
69
- +#include <errno.h>
70
- +#include <string.h>
71
- +
72
- +struct fcookie {
73
- + void *cookie;
74
- + cookie_io_functions_t iofuncs;
75
- +};
76
- +
77
- +struct cookie_FILE {
78
- + FILE f;
79
- + struct fcookie fc;
80
- + unsigned char buf[UNGET+BUFSIZ];
81
- +};
82
- +
83
- +static size_t cookieread(FILE *f, unsigned char *buf, size_t len)
84
- +{
85
- + struct fcookie *fc = f->cookie;
86
- + ssize_t ret = -1;
87
- + size_t remain = len, readlen = 0;
88
- + size_t len2 = len - !!f->buf_size;
89
- +
90
- + if (!fc->iofuncs.read) goto bail;
91
- +
92
- + if (len2) {
93
- + ret = fc->iofuncs.read(fc->cookie, (char *) buf, len2);
94
- + if (ret <= 0) goto bail;
95
- +
96
- + readlen += ret;
97
- + remain -= ret;
98
- + }
99
- +
100
- + if (!f->buf_size || remain > !!f->buf_size) return readlen;
101
- +
102
- + f->rpos = f->buf;
103
- + ret = fc->iofuncs.read(fc->cookie, (char *) f->rpos, f->buf_size);
104
- + if (ret <= 0) goto bail;
105
- + f->rend = f->rpos + ret;
106
- +
107
- + buf[readlen++] = *f->rpos++;
108
- +
109
- + return readlen;
110
- +
111
- +bail:
112
- + f->flags |= ret == 0 ? F_EOF : F_ERR;
113
- + f->rpos = f->rend = f->buf;
114
- + return readlen;
115
- +}
116
- +
117
- +static size_t cookiewrite(FILE *f, const unsigned char *buf, size_t len)
118
- +{
119
- + struct fcookie *fc = f->cookie;
120
- + ssize_t ret;
121
- + size_t len2 = f->wpos - f->wbase;
122
- + if (!fc->iofuncs.write) return len;
123
- + if (len2) {
124
- + f->wpos = f->wbase;
125
- + if (cookiewrite(f, f->wpos, len2) < len2) return 0;
126
- + }
127
- + ret = fc->iofuncs.write(fc->cookie, (const char *) buf, len);
128
- + if (ret < 0) {
129
- + f->wpos = f->wbase = f->wend = 0;
130
- + f->flags |= F_ERR;
131
- + return 0;
132
- + }
133
- + return ret;
134
- +}
135
- +
136
- +static off_t cookieseek(FILE *f, off_t off, int whence)
137
- +{
138
- + struct fcookie *fc = f->cookie;
139
- + int res;
140
- + if (whence > 2U) {
141
- + errno = EINVAL;
142
- + return -1;
143
- + }
144
- + if (!fc->iofuncs.seek) {
145
- + errno = ENOTSUP;
146
- + return -1;
147
- + }
148
- + res = fc->iofuncs.seek(fc->cookie, &off, whence);
149
- + if (res < 0)
150
- + return res;
151
- + return off;
152
- +}
153
- +
154
- +static int cookieclose(FILE *f)
155
- +{
156
- + struct fcookie *fc = f->cookie;
157
- + if (fc->iofuncs.close) return fc->iofuncs.close(fc->cookie);
158
- + return 0;
159
- +}
160
- +
161
- +FILE *fopencookie(void *cookie, const char *mode, cookie_io_functions_t iofuncs)
162
- +{
163
- + struct cookie_FILE *f;
164
- +
165
- + /* Check for valid initial mode character */
166
- + if (!strchr("rwa", *mode)) {
167
- + errno = EINVAL;
168
- + return 0;
169
- + }
170
- +
171
- + /* Allocate FILE+fcookie+buffer or fail */
172
- + if (!(f=malloc(sizeof *f))) return 0;
173
- +
174
- + /* Zero-fill only the struct, not the buffer */
175
- + memset(&f->f, 0, sizeof f->f);
176
- +
177
- + /* Impose mode restrictions */
178
- + if (!strchr(mode, '+')) f->f.flags = (*mode == 'r') ? F_NOWR : F_NORD;
179
- +
180
- + /* Set up our fcookie */
181
- + f->fc.cookie = cookie;
182
- + f->fc.iofuncs.read = iofuncs.read;
183
- + f->fc.iofuncs.write = iofuncs.write;
184
- + f->fc.iofuncs.seek = iofuncs.seek;
185
- + f->fc.iofuncs.close = iofuncs.close;
186
- +
187
- + f->f.fd = -1;
188
- + f->f.cookie = &f->fc;
189
- + f->f.buf = f->buf + UNGET;
190
- + f->f.buf_size = BUFSIZ;
191
- + f->f.lbf = EOF;
192
- +
193
- + /* Initialize op ptrs. No problem if some are unneeded. */
194
- + f->f.read = cookieread;
195
- + f->f.write = cookiewrite;
196
- + f->f.seek = cookieseek;
197
- + f->f.close = cookieclose;
198
- +
199
- + /* Add new FILE to open file list */
200
- + return __ofl_add(&f->f);
201
- +}
202
- --
203
- cgit v0.11.2
204
-
patches/musl/musl-0002-fopencookie+abi-compat.patch DELETED
@@ -1,27 +0,0 @@
1
- From 2488d31f5a946e63e40058baf29fd2991343ea6f Mon Sep 17 00:00:00 2001
2
- From: Rich Felker <dalias@aerifal.cx>
3
- Date: Wed, 6 Dec 2017 13:14:22 -0500
4
- Subject: adjust fopencookie structure tag for ABI-compat
5
-
6
- stdio types use the struct tag names from glibc libio to match C++
7
- ABI.
8
- ---
9
- include/stdio.h | 2 +-
10
- 1 file changed, 1 insertion(+), 1 deletion(-)
11
-
12
- diff --git a/include/stdio.h b/include/stdio.h
13
- index 2932c76..7c4f9ee 100644
14
- --- a/include/stdio.h
15
- +++ b/include/stdio.h
16
- @@ -188,7 +188,7 @@ typedef ssize_t (cookie_write_function_t)(void *, const char *, size_t);
17
- typedef int (cookie_seek_function_t)(void *, off_t *, int);
18
- typedef int (cookie_close_function_t)(void *);
19
-
20
- -typedef struct {
21
- +typedef struct _IO_cookie_io_functions_t {
22
- cookie_read_function_t *read;
23
- cookie_write_function_t *write;
24
- cookie_seek_function_t *seek;
25
- --
26
- cgit v0.11.2
27
-
patches/musl/musl-0003-remove-inclusion-guard-hacks-for-sys-kd.h.patch DELETED
@@ -1,39 +0,0 @@
1
- From 2fab90a71acd3698954c08b9062db67188443dd7 Mon Sep 17 00:00:00 2001
2
- From: midipix <writeonce@midipix.org>
3
- Date: Sat, 14 Jul 2018 22:49:06 -0400
4
- Subject: [PATCH 1/2] remove inclusion guard hacks for sys/kd.h
5
- MIME-Version: 1.0
6
- Content-Type: text/plain; charset=UTF-8
7
- Content-Transfer-Encoding: 8bit
8
-
9
- maintainer's note: at some point, probably long before linux separated
10
- the uapi headers, it was the case, or at least I believed it was the
11
- case, that linux/types.h was unsafe to include from userspace. thus,
12
- the inclusion guard macro _LINUX_TYPES_H was defined in sys/kd.h to
13
- prevent linux/kd.h from including linux/types.h (which it spuriously
14
- includes but does not use). as far as I can tell, whatever problem
15
- this was meant to solve does not seem to have been present for a long
16
- time, and the hack was not done correctly anyway, so removing it is
17
- the right thing to do.
18
-
19
- Signed-off-by: Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
20
- ---
21
- include/sys/kd.h | 7 -------
22
- 1 file changed, 7 deletions(-)
23
-
24
- diff --git a/include/sys/kd.h b/include/sys/kd.h
25
- index 793fd59f..33b873f4 100644
26
- --- a/include/sys/kd.h
27
- +++ b/include/sys/kd.h
28
- @@ -1,8 +1 @@
29
- -#ifndef _SYS_KD_H
30
- -#define _SYS_KD_H
31
- -
32
- -#define _LINUX_TYPES_H
33
- #include <linux/kd.h>
34
- -#undef _LINUX_TYPES_H
35
- -
36
- -#endif
37
- --
38
- 2.17.0
39
-
patches/musl/musl-0004-move-inclusion-of-linux-headers-for-kd.h-soundcard.h.patch DELETED
@@ -1,77 +0,0 @@
1
- From f2c6dbe2442027ed8fe0fa869918e41f495534d8 Mon Sep 17 00:00:00 2001
2
- From: midipix <writeonce@midipix.org>
3
- Date: Sat, 14 Jul 2018 22:51:22 -0400
4
- Subject: [PATCH 2/2] move inclusion of linux headers for kd.h, soundcard.h,
5
- vt.h to bits
6
- MIME-Version: 1.0
7
- Content-Type: text/plain; charset=UTF-8
8
- Content-Transfer-Encoding: 8bit
9
-
10
- maintainer's note: while musl does not use the linux kernel headers,
11
- it does provide these three sys/* headers which do nothing but include
12
- the corresponding linux/* headers, since the sys/* versions are the
13
- ones documented for application use (and they arguably provide
14
- interfaces that are not linux-specific but common to other unices).
15
- these headers should probably not be provided by libc (rather by a
16
- separate package), but as long as they are, use the bits header
17
- framework as an aid to out-of-tree ports of musl for non-linux systems
18
- that want to implement them in some other way.
19
-
20
- Signed-off-by: Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
21
- ---
22
- arch/generic/bits/kd.h | 1 +
23
- arch/generic/bits/soundcard.h | 1 +
24
- arch/generic/bits/vt.h | 1 +
25
- include/sys/kd.h | 2 +-
26
- include/sys/soundcard.h | 2 +-
27
- include/sys/vt.h | 2 +-
28
- 6 files changed, 6 insertions(+), 3 deletions(-)
29
- create mode 100644 arch/generic/bits/kd.h
30
- create mode 100644 arch/generic/bits/soundcard.h
31
- create mode 100644 arch/generic/bits/vt.h
32
-
33
- diff --git a/arch/generic/bits/kd.h b/arch/generic/bits/kd.h
34
- new file mode 100644
35
- index 00000000..33b873f4
36
- --- /dev/null
37
- +++ b/arch/generic/bits/kd.h
38
- @@ -0,0 +1 @@
39
- +#include <linux/kd.h>
40
- diff --git a/arch/generic/bits/soundcard.h b/arch/generic/bits/soundcard.h
41
- new file mode 100644
42
- index 00000000..fade986f
43
- --- /dev/null
44
- +++ b/arch/generic/bits/soundcard.h
45
- @@ -0,0 +1 @@
46
- +#include <linux/soundcard.h>
47
- diff --git a/arch/generic/bits/vt.h b/arch/generic/bits/vt.h
48
- new file mode 100644
49
- index 00000000..834abfbc
50
- --- /dev/null
51
- +++ b/arch/generic/bits/vt.h
52
- @@ -0,0 +1 @@
53
- +#include <linux/vt.h>
54
- diff --git a/include/sys/kd.h b/include/sys/kd.h
55
- index 33b873f4..42122b9c 100644
56
- --- a/include/sys/kd.h
57
- +++ b/include/sys/kd.h
58
- @@ -1 +1 @@
59
- -#include <linux/kd.h>
60
- +#include <bits/kd.h>
61
- diff --git a/include/sys/soundcard.h b/include/sys/soundcard.h
62
- index fade986f..5ca77646 100644
63
- --- a/include/sys/soundcard.h
64
- +++ b/include/sys/soundcard.h
65
- @@ -1 +1 @@
66
- -#include <linux/soundcard.h>
67
- +#include <bits/soundcard.h>
68
- diff --git a/include/sys/vt.h b/include/sys/vt.h
69
- index 834abfbc..5000de49 100644
70
- --- a/include/sys/vt.h
71
- +++ b/include/sys/vt.h
72
- @@ -1 +1 @@
73
- -#include <linux/vt.h>
74
- +#include <bits/vt.h>
75
- --
76
- 2.17.0
77
-