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

Commit 9af641b

Browse files
committed
[Musl] Fill in empty version blocks for extern(C) bindings
1 parent 9076669 commit 9af641b

File tree

6 files changed

+73
-8
lines changed

6 files changed

+73
-8
lines changed

src/core/sys/posix/dirent.d

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ else version (CRuntime_Bionic)
506506
}
507507
else version (CRuntime_Musl)
508508
{
509-
509+
int readdir_r(DIR*, dirent*, dirent**);
510510
}
511511
else version (CRuntime_UClibc)
512512
{
@@ -591,6 +591,8 @@ else version (CRuntime_Bionic)
591591
}
592592
else version (CRuntime_Musl)
593593
{
594+
void seekdir(DIR*, c_long);
595+
c_long telldir(DIR*);
594596
}
595597
else version (CRuntime_UClibc)
596598
{

src/core/sys/posix/pthread.d

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,15 @@ else version (CRuntime_Bionic)
854854
}
855855
else version (CRuntime_Musl)
856856
{
857+
enum PTHREAD_BARRIER_SERIAL_THREAD = -1;
857858

859+
int pthread_barrier_destroy(pthread_barrier_t*);
860+
int pthread_barrier_init(pthread_barrier_t*, const scope pthread_barrierattr_t*, uint);
861+
int pthread_barrier_wait(pthread_barrier_t*);
862+
int pthread_barrierattr_destroy(pthread_barrierattr_t*);
863+
int pthread_barrierattr_getpshared(const scope pthread_barrierattr_t*, int*);
864+
int pthread_barrierattr_init(pthread_barrierattr_t*);
865+
int pthread_barrierattr_setpshared(pthread_barrierattr_t*, int);
858866
}
859867
else version (CRuntime_UClibc)
860868
{
@@ -917,6 +925,8 @@ else version (CRuntime_Bionic)
917925
}
918926
else version (CRuntime_Musl)
919927
{
928+
int pthread_condattr_getclock(const scope pthread_condattr_t*, clockid_t*);
929+
int pthread_condattr_setclock(pthread_condattr_t*, clockid_t);
920930
}
921931
else version (CRuntime_UClibc)
922932
{
@@ -995,7 +1005,11 @@ else version (CRuntime_Bionic)
9951005
}
9961006
else version (CRuntime_Musl)
9971007
{
998-
1008+
int pthread_spin_destroy(pthread_spinlock_t*);
1009+
int pthread_spin_init(pthread_spinlock_t*, int);
1010+
int pthread_spin_lock(pthread_spinlock_t*);
1011+
int pthread_spin_trylock(pthread_spinlock_t*);
1012+
int pthread_spin_unlock(pthread_spinlock_t*);
9991013
}
10001014
else version (CRuntime_UClibc)
10011015
{
@@ -1234,7 +1248,7 @@ else version (CRuntime_Bionic)
12341248
}
12351249
else version (CRuntime_Musl)
12361250
{
1237-
1251+
int pthread_getcpuclockid(pthread_t, clockid_t*);
12381252
}
12391253
else version (CRuntime_UClibc)
12401254
{
@@ -1303,7 +1317,9 @@ else version (CRuntime_Bionic)
13031317
}
13041318
else version (CRuntime_Musl)
13051319
{
1306-
1320+
int pthread_mutex_timedlock(pthread_mutex_t*, const scope timespec*);
1321+
int pthread_rwlock_timedrdlock(pthread_rwlock_t*, const scope timespec*);
1322+
int pthread_rwlock_timedwrlock(pthread_rwlock_t*, const scope timespec*);
13071323
}
13081324
else version (CRuntime_UClibc)
13091325
{
@@ -1740,7 +1756,12 @@ else version (CRuntime_Bionic)
17401756
}
17411757
else version (CRuntime_Musl)
17421758
{
1743-
1759+
int pthread_condattr_getpshared(pthread_condattr_t*, int*);
1760+
int pthread_condattr_setpshared(pthread_condattr_t*, int);
1761+
int pthread_mutexattr_getpshared(pthread_mutexattr_t*, int*);
1762+
int pthread_mutexattr_setpshared(pthread_mutexattr_t*, int);
1763+
int pthread_rwlockattr_getpshared(pthread_rwlockattr_t*, int*);
1764+
int pthread_rwlockattr_setpshared(pthread_rwlockattr_t*, int);
17441765
}
17451766
else version (CRuntime_UClibc)
17461767
{

src/core/sys/posix/pwd.d

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,8 @@ else version (CRuntime_Bionic)
172172
}
173173
else version (CRuntime_Musl)
174174
{
175-
struct passwd {
175+
struct passwd
176+
{
176177
char *pw_name;
177178
char *pw_passwd;
178179
uid_t pw_uid;
@@ -257,6 +258,8 @@ else version (CRuntime_Bionic)
257258
}
258259
else version (CRuntime_Musl)
259260
{
261+
int getpwnam_r(const scope char*, passwd*, char*, size_t, passwd**);
262+
int getpwuid_r(uid_t, passwd*, char*, size_t, passwd**);
260263
}
261264
else version (CRuntime_UClibc)
262265
{
@@ -325,8 +328,9 @@ else version (CRuntime_Bionic)
325328
}
326329
else version (CRuntime_Musl)
327330
{
328-
int getpwnam_r(const scope char*, passwd*, char*, size_t, passwd**);
329-
int getpwuid_r(uid_t, passwd*, char*, size_t, passwd**);
331+
void endpwent();
332+
passwd* getpwent();
333+
void setpwent();
330334
}
331335
else version (CRuntime_UClibc)
332336
{

src/core/sys/posix/sys/mman.d

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,15 @@ else version (CRuntime_Bionic)
137137
}
138138
else version (CRuntime_Musl)
139139
{
140+
enum
141+
{
142+
POSIX_MADV_NORMAL = 0,
143+
POSIX_MADV_RANDOM = 1,
144+
POSIX_MADV_SEQUENTIAL = 2,
145+
POSIX_MADV_WILLNEED = 3,
146+
POSIX_MADV_DONTNEED = 4,
147+
}
148+
int posix_madvise(void *, size_t, int);
140149
}
141150
else version (CRuntime_UClibc)
142151
{
@@ -655,6 +664,14 @@ else version (CRuntime_Bionic)
655664
}
656665
else version (CRuntime_Musl)
657666
{
667+
enum
668+
{
669+
MCL_CURRENT = 1,
670+
MCL_FUTURE = 2,
671+
}
672+
673+
int mlockall(int);
674+
int munlockall();
658675
}
659676
else version (CRuntime_UClibc)
660677
{
@@ -723,6 +740,8 @@ else version (CRuntime_Bionic)
723740
}
724741
else version (CRuntime_Musl)
725742
{
743+
int mlock(const scope void*, size_t);
744+
int munlock(const scope void*, size_t);
726745
}
727746
else version (CRuntime_UClibc)
728747
{
@@ -834,6 +853,8 @@ else version (CRuntime_Bionic)
834853
}
835854
else version (CRuntime_Musl)
836855
{
856+
int shm_open(const scope char*, int, mode_t);
857+
int shm_unlink(const scope char*);
837858
}
838859
else version (CRuntime_UClibc)
839860
{

src/core/sys/posix/sys/socket.d

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2304,6 +2304,10 @@ else version (CRuntime_Bionic)
23042304
}
23052305
else version (CRuntime_Musl)
23062306
{
2307+
enum
2308+
{
2309+
SOCK_RAW = 3
2310+
}
23072311
}
23082312
else version (CRuntime_UClibc)
23092313
{

src/core/sys/posix/sys/wait.d

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,19 @@ else version (CRuntime_Bionic)
392392
}
393393
else version (CRuntime_Musl)
394394
{
395+
enum WEXITED = 4;
396+
enum WSTOPPED = 2;
397+
enum WCONTINUED = 8;
398+
enum WNOWAIT = 0x01000000;
399+
400+
enum idtype_t
401+
{
402+
P_ALL,
403+
P_PID,
404+
P_PGID
405+
}
406+
407+
int waitid(idtype_t, id_t, siginfo_t*, int);
395408
}
396409
else version (CRuntime_UClibc)
397410
{

0 commit comments

Comments
 (0)