Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 4dc5d92

Browse files
author
Ernesto Castellotti
committed
Fix Issue 16380 - no bindings for err.h
err.h although not present in the posix standard it is however present in most distributions based on Darwin, BSD and Linux Signed-off-by: Ernesto Castellotti <erny.castell@gmail.com>
1 parent bc1ef74 commit 4dc5d92

File tree

11 files changed

+266
-0
lines changed

11 files changed

+266
-0
lines changed

mak/COPY

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,12 @@ COPY=\
8686
\
8787
$(IMPDIR)\core\sync\event.d \
8888
\
89+
$(IMPDIR)\core\sys\bionic\err.d \
8990
$(IMPDIR)\core\sys\bionic\string.d \
9091
\
9192
$(IMPDIR)\core\sys\darwin\crt_externs.d \
9293
$(IMPDIR)\core\sys\darwin\dlfcn.d \
94+
$(IMPDIR)\core\sys\darwin\err.d \
9395
$(IMPDIR)\core\sys\darwin\execinfo.d \
9496
$(IMPDIR)\core\sys\darwin\pthread.d \
9597
$(IMPDIR)\core\sys\darwin\string.d \
@@ -109,6 +111,7 @@ COPY=\
109111
$(IMPDIR)\core\sys\darwin\sys\mman.d \
110112
\
111113
$(IMPDIR)\core\sys\freebsd\dlfcn.d \
114+
$(IMPDIR)\core\sys\freebsd\err.d \
112115
$(IMPDIR)\core\sys\freebsd\execinfo.d \
113116
\
114117
$(IMPDIR)\core\sys\freebsd\netinet\in_.d \
@@ -130,6 +133,7 @@ COPY=\
130133
$(IMPDIR)\core\sys\freebsd\unistd.d \
131134
\
132135
$(IMPDIR)\core\sys\dragonflybsd\dlfcn.d \
136+
$(IMPDIR)\core\sys\dragonflybsd\err.d \
133137
$(IMPDIR)\core\sys\dragonflybsd\execinfo.d \
134138
\
135139
$(IMPDIR)\core\sys\dragonflybsd\netinet\in_.d \
@@ -152,6 +156,7 @@ COPY=\
152156
$(IMPDIR)\core\sys\linux\dlfcn.d \
153157
$(IMPDIR)\core\sys\linux\elf.d \
154158
$(IMPDIR)\core\sys\linux\epoll.d \
159+
$(IMPDIR)\core\sys\linux\err.d \
155160
$(IMPDIR)\core\sys\linux\errno.d \
156161
$(IMPDIR)\core\sys\linux\execinfo.d \
157162
$(IMPDIR)\core\sys\linux\fcntl.d \
@@ -180,10 +185,12 @@ COPY=\
180185
$(IMPDIR)\core\sys\linux\sys\time.d \
181186
$(IMPDIR)\core\sys\linux\sys\prctl.d \
182187
\
188+
$(IMPDIR)\core\sys\netbsd\err.d \
183189
$(IMPDIR)\core\sys\netbsd\sys\featuretest.d \
184190
$(IMPDIR)\core\sys\netbsd\string.d \
185191
\
186192
$(IMPDIR)\core\sys\openbsd\dlfcn.d \
193+
$(IMPDIR)\core\sys\openbsd\err.d \
187194
$(IMPDIR)\core\sys\openbsd\string.d \
188195
\
189196
$(IMPDIR)\core\sys\posix\arpa\inet.d \
@@ -240,6 +247,7 @@ COPY=\
240247
\
241248
$(IMPDIR)\core\sys\solaris\dlfcn.d \
242249
$(IMPDIR)\core\sys\solaris\elf.d \
250+
$(IMPDIR)\core\sys\solaris\err.d \
243251
$(IMPDIR)\core\sys\solaris\execinfo.d \
244252
$(IMPDIR)\core\sys\solaris\libelf.d \
245253
$(IMPDIR)\core\sys\solaris\link.d \

mak/SRCS

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,12 @@ SRCS=\
9090
src\core\sync\rwmutex.d \
9191
src\core\sync\semaphore.d \
9292
\
93+
src\core\sys\bionic\err.d \
9394
src\core\sys\bionic\string.d \
9495
\
9596
src\core\sys\darwin\crt_externs.d \
9697
src\core\sys\darwin\dlfcn.d \
98+
src\core\sys\darwin\err.d \
9799
src\core\sys\darwin\execinfo.d \
98100
src\core\sys\darwin\pthread.d \
99101
src\core\sys\darwin\string.d \
@@ -111,6 +113,7 @@ SRCS=\
111113
src\core\sys\darwin\sys\mman.d \
112114
\
113115
src\core\sys\freebsd\dlfcn.d \
116+
src\core\sys\freebsd\err.d \
114117
src\core\sys\freebsd\execinfo.d \
115118
src\core\sys\freebsd\netinet\in_.d \
116119
src\core\sys\freebsd\pthread_np.d \
@@ -130,6 +133,7 @@ SRCS=\
130133
src\core\sys\freebsd\unistd.d \
131134
\
132135
src\core\sys\dragonflybsd\dlfcn.d \
136+
src\core\sys\dragonflybsd\err.d \
133137
src\core\sys\dragonflybsd\execinfo.d \
134138
src\core\sys\dragonflybsd\netinet\in_.d \
135139
src\core\sys\dragonflybsd\pthread_np.d \
@@ -150,6 +154,7 @@ SRCS=\
150154
src\core\sys\linux\dlfcn.d \
151155
src\core\sys\linux\elf.d \
152156
src\core\sys\linux\epoll.d \
157+
src\core\sys\linux\err.d \
153158
src\core\sys\linux\errno.d \
154159
src\core\sys\linux\execinfo.d \
155160
src\core\sys\linux\fcntl.d \
@@ -178,10 +183,12 @@ SRCS=\
178183
src\core\sys\linux\sys\time.d \
179184
src\core\sys\linux\sys\prctl.d \
180185
\
186+
src\core\sys\netbsd\err.d \
181187
src\core\sys\netbsd\sys\featuretest.d \
182188
src\core\sys\netbsd\string.d \
183189
\
184190
src\core\sys\openbsd\dlfcn.d \
191+
src\core\sys\openbsd\err.d \
185192
src\core\sys\openbsd\string.d \
186193
\
187194
src\core\sys\posix\arpa\inet.d \
@@ -238,6 +245,7 @@ SRCS=\
238245
\
239246
src\core\sys\solaris\dlfcn.d \
240247
src\core\sys\solaris\elf.d \
248+
src\core\sys\solaris\err.d \
241249
src\core\sys\solaris\execinfo.d \
242250
src\core\sys\solaris\libelf.d \
243251
src\core\sys\solaris\link.d \

mak/WINDOWS

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,9 @@ $(IMPDIR)\core\stdcpp\vector.d : src\core\stdcpp\vector.d
294294
$(IMPDIR)\core\stdcpp\xutility.d : src\core\stdcpp\xutility.d
295295
copy $** $@
296296

297+
$(IMPDIR)\core\sys\bionic\err.d : src\core\sys\bionic\err.d
298+
copy $** $@
299+
297300
$(IMPDIR)\core\sys\bionic\string.d : src\core\sys\bionic\string.d
298301
copy $** $@
299302

@@ -303,6 +306,9 @@ $(IMPDIR)\core\sys\darwin\crt_externs.d : src\core\sys\darwin\crt_externs.d
303306
$(IMPDIR)\core\sys\darwin\dlfcn.d : src\core\sys\darwin\dlfcn.d
304307
copy $** $@
305308

309+
$(IMPDIR)\core\sys\darwin\err.d : src\core\sys\darwin\err.d
310+
copy $** $@
311+
306312
$(IMPDIR)\core\sys\darwin\execinfo.d : src\core\sys\darwin\execinfo.d
307313
copy $** $@
308314

@@ -348,6 +354,9 @@ $(IMPDIR)\core\sys\darwin\sys\mman.d : src\core\sys\darwin\sys\mman.d
348354
$(IMPDIR)\core\sys\freebsd\dlfcn.d : src\core\sys\freebsd\dlfcn.d
349355
copy $** $@
350356

357+
$(IMPDIR)\core\sys\freebsd\err.d : src\core\sys\freebsd\err.d
358+
copy $** $@
359+
351360
$(IMPDIR)\core\sys\freebsd\execinfo.d : src\core\sys\freebsd\execinfo.d
352361
copy $** $@
353362

@@ -402,6 +411,9 @@ $(IMPDIR)\core\sys\freebsd\unistd.d : src\core\sys\freebsd\unistd.d
402411
$(IMPDIR)\core\sys\dragonflybsd\dlfcn.d : src\core\sys\dragonflybsd\dlfcn.d
403412
copy $** $@
404413

414+
$(IMPDIR)\core\sys\dragonflybsd\err.d : src\core\sys\dragonflybsd\err.d
415+
copy $** $@
416+
405417
$(IMPDIR)\core\sys\dragonflybsd\execinfo.d : src\core\sys\dragonflybsd\execinfo.d
406418
copy $** $@
407419

@@ -459,6 +471,9 @@ $(IMPDIR)\core\sys\linux\elf.d : src\core\sys\linux\elf.d
459471
$(IMPDIR)\core\sys\linux\epoll.d : src\core\sys\linux\epoll.d
460472
copy $** $@
461473

474+
$(IMPDIR)\core\sys\linux\err.d : src\core\sys\linux\err.d
475+
copy $** $@
476+
462477
$(IMPDIR)\core\sys\linux\errno.d : src\core\sys\linux\errno.d
463478
copy $** $@
464479

@@ -534,6 +549,9 @@ $(IMPDIR)\core\sys\linux\sys\xattr.d : src\core\sys\linux\sys\xattr.d
534549
$(IMPDIR)\core\sys\linux\sys\time.d : src\core\sys\linux\sys\time.d
535550
copy $** $@
536551

552+
$(IMPDIR)\core\sys\netbsd\err.d : src\core\sys\netbsd\err.d
553+
copy $** $@
554+
537555
$(IMPDIR)\core\sys\netbsd\sys\featuretest.d : src\core\sys\netbsd\sys\featuretest.d
538556
copy $** $@
539557

@@ -543,6 +561,9 @@ $(IMPDIR)\core\sys\netbsd\string.d : src\core\sys\netbsd\string.d
543561
$(IMPDIR)\core\sys\openbsd\dlfcn.d : src\core\sys\openbsd\dlfcn.d
544562
copy $** $@
545563

564+
$(IMPDIR)\core\sys\openbsd\err.d : src\core\sys\openbsd\err.d
565+
copy $** $@
566+
546567
$(IMPDIR)\core\sys\openbsd\string.d : src\core\sys\openbsd\string.d
547568
copy $** $@
548569

@@ -696,6 +717,9 @@ $(IMPDIR)\core\sys\solaris\dlfcn.d : src\core\sys\solaris\dlfcn.d
696717
$(IMPDIR)\core\sys\solaris\elf.d : src\core\sys\solaris\elf.d
697718
copy $** $@
698719

720+
$(IMPDIR)\core\sys\solaris\err.d : src\core\sys\solaris\err.d
721+
copy $** $@
722+
699723
$(IMPDIR)\core\sys\solaris\execinfo.d : src\core\sys\solaris\execinfo.d
700724
copy $** $@
701725

src/core/sys/bionic/err.d

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* D header file for Bionic err.h.
3+
*
4+
* Copyright: Copyright © 2019, The D Language Foundation
5+
* License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
6+
* Authors: Ernesto Castellotti
7+
*/
8+
module core.sys.bionic.err;
9+
import core.stdc.stdarg : va_list;
10+
11+
version (CRuntime_Bionic):
12+
extern (C):
13+
nothrow:
14+
@nogc:
15+
16+
void err(int eval, scope const char* fmt, ...);
17+
void errx(int eval, scope const char* fmt, ...);
18+
void warn(scope const char* fmt, ...);
19+
void warnx(scope const char* fmt, ...);
20+
void verr(int eval, scope const char* fmt, va_list args);
21+
void verrx(int eval, scope const char* fmt, va_list args);
22+
void vwarn(scope const char* fmt, va_list args);
23+
void vwarnx(scope const char* fmt, va_list args);

src/core/sys/darwin/err.d

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/**
2+
* D header file for Darwin err.h.
3+
*
4+
* Copyright: Copyright © 2019, The D Language Foundation
5+
* License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
6+
* Authors: Ernesto Castellotti
7+
*/
8+
module core.sys.darwin.err;
9+
import core.stdc.stdarg : va_list;
10+
11+
version (OSX)
12+
version = Darwin;
13+
else version (iOS)
14+
version = Darwin;
15+
else version (TVOS)
16+
version = Darwin;
17+
else version (WatchOS)
18+
version = Darwin;
19+
20+
21+
version (Darwin):
22+
extern (C):
23+
nothrow:
24+
@nogc:
25+
26+
alias ExitFunction = void function(int);
27+
28+
void err(int eval, scope const char* fmt, ...);
29+
void errc(int eval, int code, scope const char* fmt, ...);
30+
void errx(int eval, scope const char* fmt, ...);
31+
void warn(scope const char* fmt, ...);
32+
void warnc(int code, scope const char* fmt, ...);
33+
void warnx(scope const char* fmt, ...);
34+
void verr(int eval, scope const char* fmt, va_list args);
35+
void verrc(int eval, int code, scope const char* fmt, va_list args);
36+
void verrx(int eval, scope const char* fmt, va_list args);
37+
void vwarn(scope const char* fmt, va_list args);
38+
void vwarnc(int code, scope const char* fmt, va_list args);
39+
void vwarnx(scope const char* fmt, va_list args);
40+
void err_set_file(void* vfp);
41+
void err_set_exit(ExitFunction exitf);

src/core/sys/dragonflybsd/err.d

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/**
2+
* D header file for DragonFlyBSD err.h.
3+
*
4+
* Copyright: Copyright © 2019, The D Language Foundation
5+
* License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
6+
* Authors: Ernesto Castellotti
7+
*/
8+
module core.sys.dragonflybsd.err;
9+
import core.stdc.stdarg : va_list;
10+
11+
version (DragonFlyBSD):
12+
extern (C):
13+
nothrow:
14+
@nogc:
15+
16+
alias ExitFunction = void function(int);
17+
18+
void err(int eval, scope const char* fmt, ...);
19+
void errc(int eval, int code, scope const char* fmt, ...);
20+
void errx(int eval, scope const char* fmt, ...);
21+
void warn(scope const char* fmt, ...);
22+
void warnc(int code, scope const char* fmt, ...);
23+
void warnx(scope const char* fmt, ...);
24+
void verr(int eval, scope const char* fmt, va_list args);
25+
void verrc(int eval, int code, scope const char* fmt, va_list args);
26+
void verrx(int eval, scope const char* fmt, va_list args);
27+
void vwarn(scope const char* fmt, va_list args);
28+
void vwarnc(int code, scope const char* fmt, va_list args);
29+
void vwarnx(scope const char* fmt, va_list args);
30+
void err_set_file(void* vfp);
31+
void err_set_exit(ExitFunction exitf);

src/core/sys/freebsd/err.d

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/**
2+
* D header file for FreeBSD err.h.
3+
*
4+
* Copyright: Copyright © 2019, The D Language Foundation
5+
* License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
6+
* Authors: Ernesto Castellotti
7+
*/
8+
module core.sys.freebsd.err;
9+
import core.stdc.stdarg : va_list;
10+
11+
version (FreeBSD):
12+
extern (C):
13+
nothrow:
14+
@nogc:
15+
16+
alias ExitFunction = void function(int);
17+
18+
void err(int eval, scope const char* fmt, ...);
19+
void errc(int eval, int code, scope const char* fmt, ...);
20+
void errx(int eval, scope const char* fmt, ...);
21+
void warn(scope const char* fmt, ...);
22+
void warnc(int code, scope const char* fmt, ...);
23+
void warnx(scope const char* fmt, ...);
24+
void verr(int eval, scope const char* fmt, va_list args);
25+
void verrc(int eval, int code, scope const char* fmt, va_list args);
26+
void verrx(int eval, scope const char* fmt, va_list args);
27+
void vwarn(scope const char* fmt, va_list args);
28+
void vwarnc(int code, scope const char* fmt, va_list args);
29+
void vwarnx(scope const char* fmt, va_list args);
30+
void err_set_file(void* vfp);
31+
void err_set_exit(ExitFunction exitf);

src/core/sys/linux/err.d

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* D header file for Linux err.h.
3+
*
4+
* Copyright: Copyright © 2019, The D Language Foundation
5+
* License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
6+
* Authors: Ernesto Castellotti
7+
*/
8+
module core.sys.linux.err;
9+
import core.stdc.stdarg : va_list;
10+
11+
version (linux):
12+
extern (C):
13+
nothrow:
14+
@nogc:
15+
16+
void err(int eval, scope const char* fmt, ...);
17+
void errx(int eval, scope const char* fmt, ...);
18+
void warn(scope const char* fmt, ...);
19+
void warnx(scope const char* fmt, ...);
20+
void verr(int eval, scope const char* fmt, va_list args);
21+
void verrx(int eval, scope const char* fmt, va_list args);
22+
void vwarn(scope const char* fmt, va_list args);
23+
void vwarnx(scope const char* fmt, va_list args);

src/core/sys/netbsd/err.d

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* D header file for NetBSD err.h.
3+
*
4+
* Copyright: Copyright © 2019, The D Language Foundation
5+
* License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
6+
* Authors: Ernesto Castellotti
7+
*/
8+
module core.sys.netbsd.err;
9+
import core.stdc.stdarg : va_list;
10+
11+
version (NetBSD):
12+
extern (C):
13+
nothrow:
14+
@nogc:
15+
16+
void err(int eval, scope const char* fmt, ...);
17+
void errc(int eval, int code, scope const char* fmt, ...);
18+
void errx(int eval, scope const char* fmt, ...);
19+
void warn(scope const char* fmt, ...);
20+
void warnc(int code, scope const char* fmt, ...);
21+
void warnx(scope const char* fmt, ...);
22+
void verr(int eval, scope const char* fmt, va_list args);
23+
void verrc(int eval, int code, scope const char* fmt, va_list args);
24+
void verrx(int eval, scope const char* fmt, va_list args);
25+
void vwarn(scope const char* fmt, va_list args);
26+
void vwarnc(int code, scope const char* fmt, va_list args);
27+
void vwarnx(scope const char* fmt, va_list args);

0 commit comments

Comments
 (0)