1 /*
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % File:         pslstubs.c
5 % Description:  Code to help with portability across operating systems
6 % Author:       Arthur Norman
7 % Created:      February 2018
8 % Mode:         Text
9 % Status:       Open Source: BSD License
10 %
11 % (c) Copyright 2018 A C Norman.
12 %
13 % Redistribution and use in source and binary forms, with or without
14 % modification, are permitted provided that the following conditions are met:
15 %
16 %    * Redistributions of source code must retain the relevant copyright
17 %      notice, this list of conditions and the following disclaimer.
18 %    * Redistributions in binary form must reproduce the above copyright
19 %      notice, this list of conditions and the following disclaimer in the
20 %      documentation and/or other materials provided with the distribution.
21 %
22 % THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 % AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
24 % THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25 % PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNERS OR
26 % CONTRIBUTORS
27 % BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 % CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 % SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 % INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 % CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 % ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 % POSSIBILITY OF SUCH DAMAGE.
34 %
35 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
36 */
37 
38 
39 #include "psl.h"
40 
41 #ifdef __CYGWIN__
42 
43 #include <windows.h>
44 
45 /* This is expected to be rather similar to the Linux case.
46  */
47 
_get_registry_value(const char * a,const char * b,const char * c,char * d)48 int _get_registry_value(const char *a, const char *b, const char *c, char *d)
49 {   TR1("getregistryvalue");
50     return 1;
51 //  return getregistryvalue(a, b, c, d);
52 }
53 
profil()54 int profil()
55 {   TR1("profil");
56     return 0;
57 }
58 
sigrelse(int s)59 int sigrelse(int s)
60 {   TR1("sigrelse");
61     return 0;
62 }
63 
pthread_getconcurrency()64 int pthread_getconcurrency()
65 {   TR1("pthread_getconcurrency");
66     return 0;
67 }
68 
pthread_yield()69 int pthread_yield()
70 {   TR1("pthread_yield");
71     return 0;
72 }
73 
74 typedef void *cpu_set_t;
75 
pthread_setaffinity_np()76 int pthread_setaffinity_np()
77 {   TR1("pthread_setaffinity");
78     return 0;
79 }
80 
pthread_getaffinity_np()81 int pthread_getaffinity_np()
82 {   TR1("pthread_getaffinity");
83     return 0;
84 }
85 
pthread_rwlockattr_getkind_np()86 int pthread_rwlockattr_getkind_np()
87 {   TR1("pthread_rwlockattr_getkind");
88     return 0;
89 }
90 
pthread_rwlockattr_setkind_np()91 int pthread_rwlockattr_setkind_np()
92 {   TR1("pthread_rwlockatr_setkind");
93     return 0;
94 }
95 
96 /*
97  * And now pretend to be Linux!
98  */
99 
100 #define __linux__
101 
102 #endif // __CYGWIN__
103 
104 #ifdef __clang__
105 
106 /* Foe the Macintosh.
107  */
108 
109 
profil()110 int profil()
111 {   TR1("profil");
112     return 0;
113 }
114 
pthread_yield()115 int pthread_yield()
116 {   TR1("pthread_yield");
117     return 0;
118 }
119 
pthread_setaffinity_np()120 int pthread_setaffinity_np()
121 {   TR1("pthraed_setaffinity");
122     return 0;
123 }
124 
pthread_getaffinity_np()125 int pthread_getaffinity_np()
126 {   TR1("pthread_getaffinity");
127     return 0;
128 }
129 
pthread_rwlockattr_getkind_np()130 int pthread_rwlockattr_getkind_np()
131 {   TR1("pthraed_rwlockattr_getkind");
132     return 0;
133 }
134 
pthread_rwlockattr_setkind_np()135 int pthread_rwlockattr_setkind_np()
136 {   TR1("pthread_rwlockattr_setkind");
137     return 0;
138 }
139 
pthread_setschedprio()140 int pthread_setschedprio()
141 {   TR1("pthread_setschedprio");
142     return 0;
143 }
144 
145 #include <stdio.h>
146 
147 FILE *unixstdin, *unixstdout, *unixstderr, *unixtty;
148 
149 int64_t unixnull[2], unixeof[2];
150 
151 #endif // __clang__
152 
153 #ifdef __linux__
154 
155 /* You might have expected the Linux support to be the easiest one. However
156  * in seeking portability of everything I have ended up needing to provide
157  * stubs here the link from calls to names with underscores on them to
158  * calls without! This may not end up being essential, but I observe that
159  * already there are a fair number of system functions that are called
160  * via trivial interface code of this sort (eg all the elementary functions)
161  * so this does not breach the spirit of the PSL implementation too
162  * badly.
163  *
164  * Furthermore the little functions here will generally compile into just
165  * a simple jump instructions:
166  *    _foo: jmp foo@PLT
167  * and if the target concerned ends up reasonably close that will end up
168  * as a pc-relative jump - while if it is seriously remote it will be a
169  * jump via a memory location that contains the long address. This is not
170  * a severe burden in any case, because the functions that are called will
171  * do enough that their costs swamp that of the extra jump.
172  */
173 
174 #include <stdio.h>
175 
176 /*
177  * I have to define the following - at least on some platforms - to get
178  * functions defined in header files. These are often obsolete or non-standard
179  * names that are used and it may be a good idea to review the code and
180  * arrange that mess like this is not required.
181  */
182 
183 /* sigrelse seems to need XOPEN_EXTENDED, and the man page says that it is
184  * only provided for programs that make use of the historical System V signal
185  * API, and that new applications should use the POSIX versions (ie sigaction
186  * and friends).
187  */
188 #define __USE_XOPEN_EXTENDED 1
189 
190 #define __USE_UNIX98 1
191 
192 /* pthread_setaffinity is for GNU */
193 #define __USE_GNU 1
194 
195 #include <signal.h>
196 #include <sys/types.h>
197 #include <unistd.h>
198 #include <wait.h>
199 #include <pthread.h>
200 #include <time.h>
201 #include <sys/ipc.h>
202 #include <sys/shm.h>
203 #include <sys/sem.h>
204 #include <dlfcn.h>
205 
206 
207 /* sigrelse is obsolete - use sigaction etc instead... */
_sigrelse(int s)208 int _sigrelse(int s)
209 {   TR1("sigrelse");
210     return sigrelse(s);
211 }
212 
_ctime(const time_t * t)213 char *_ctime(const time_t *t)
214 {   TR1("ctime");
215     return ctime(t);
216 }
217 
_fopen(const char * name,const char * mode)218 FILE *_fopen(const char *name, const char *mode)
219 {   TR1("fopen");
220     return fopen(name, mode);
221 }
222 
_fclose(FILE * s)223 int _fclose(FILE *s)
224 {   TR1("fclose");
225     return fclose(s);
226 }
227 
_fread(void * p,size_t n,size_t m,FILE * s)228 size_t _fread(void *p, size_t n, size_t m, FILE *s)
229 {   TR1("fread");
230     fprintf(stderr, "fread(%p, %d, %d, %p)", p, (int)n, (int)m, s);
231     fflush(stderr);
232     size_t r = fread(p, n, m, s);
233     fprintf(stderr, " = %d\n", (int)r);
234     return r;
235 }
236 
_fputc(int c,FILE * s)237 int _fputc(int c, FILE *s)
238 {   TR1("fputc");
239     return putc(c, s);
240 }
241 
_fgetc(FILE * s)242 int _fgetc(FILE *s)
243 {   TR1("fgetc");
244     return getc(s);
245 }
246 
_fgets(char * s,int n,FILE * f)247 char *_fgets(char *s, int n, FILE *f)
248 {   TR1("fgets");
249     return fgets(s, n, f);
250 }
251 
_fwrite(void * p,size_t n,size_t m,FILE * s)252 size_t _fwrite(void *p, size_t n, size_t m, FILE *s)
253 {   TR1("fwrite");
254     return fwrite(p, n, m, s);
255 }
256 
_fflush(FILE * f)257 int _fflush(FILE *f)
258 {   TR1("fflush");
259     return fflush(f);
260 }
261 
_fseek(FILE * s,long o,int w)262 int _fseek(FILE *s, long o, int w)
263 {   TR1("fseek");
264     return fseek(s, o, w);
265 }
266 
_clearerr(FILE * s)267 void _clearerr(FILE *s)
268 {   TR1("clearerr");
269     clearerr(s);
270 }
271 
_putw(int w,FILE * s)272 int _putw(int w, FILE *s)
273 {   TR1("putw");
274     return putw(w, s);
275 }
276 
277 /*
278  * Sometimes signal is defined using a type sighandler_t, but the
279  * typedef is given different names on Linux, BSD and Cygwin, so I write
280  * out the underlying type directly here. The function signal is perhaps now
281  * obsolete with sighandler now preferred.
282  */
283 
_signal(int s,void (* h)(int))284 void (*_signal(int s, void (*h)(int)))(int)
285 {   TR1("signal");
286     return signal(s, h);
287 }
288 
_sleep(unsigned int n)289 unsigned int _sleep(unsigned int n)
290 {   TR1("sleep");
291     return sleep(n);
292 }
293 
_setlinebuf(FILE * s)294 void _setlinebuf(FILE *s)
295 {   TR1("setlinebuf");
296     setlinebuf(s);
297 }
298 
_getpid()299 pid_t _getpid()
300 {   TR1("getpid");
301     return getpid();
302 }
303 
_gethostid()304 long _gethostid()
305 {   TR1("gethostid");
306     return gethostid();
307 }
308 
_fork()309 pid_t _fork()
310 {   TR1("fork");
311     return fork();
312 }
313 
_wait(int * w)314 pid_t _wait(int *w)
315 {   TR1("wait");
316     return wait(w);
317 }
318 
_popen(const char * s,const char * t)319 FILE *_popen(const char *s, const char *t)
320 {   TR1("popen");
321     return popen(s, t);
322 }
323 
_pclose(FILE * s)324 int _pclose(FILE *s)
325 {   TR1("pclose");
326     return pclose(s);
327 }
328 
_shmctl(int id,int c,struct shmid_ds * d)329 int _shmctl(int id, int c, struct shmid_ds *d)
330 {   TR1("shmctl");
331     return shmctl(id, c, d);
332 }
333 
_shmget(key_t k,size_t n,int f)334 int _shmget(key_t k, size_t n, int f)
335 {   TR1("shmget");
336     return shmget(k, n, f);
337 }
338 
_shmat(int id,const void * ad,int f)339 void *_shmat(int id, const void *ad, int f)
340 {   TR1("shmat");
341     return shmat(id, ad, f);
342 }
343 
_shmdt(const void * ad)344 int _shmdt(const void *ad)
345 {   TR1("shmdt");
346     return shmdt(ad);
347 }
348 
_semctl(int id,int num,int cmd,...)349 int _semctl(int id, int num, int cmd, ...)
350 {   TR1("semctl");
351     return semctl(id, num, cmd); /* Extra arg not supported here yet */
352 }
353 
_semget(key_t k,int n,int f)354 int _semget(key_t k, int n, int f)
355 {   TR1("semget");
356     return semget(k, n, f);
357 }
358 
_semop(int id,struct sembuf * b,size_t n)359 int _semop(int id, struct sembuf *b, size_t n)
360 {   TR1("semop");
361     return semop(id, b, n);
362 }
363 
_dlopen(const char * name,int f)364 void *_dlopen(const char *name, int f)
365 {   TR1("dlopen");
366     return dlopen(name, f);
367 }
368 
_dlerror()369 char *_dlerror()
370 {   TR1("dlerror");
371     return dlerror();
372 }
373 
_dlsym(void * h,const char * s)374 void *_dlsym(void *h, const char *s)
375 {   TR1("dlsym");
376     return dlsym(h, s);
377 }
378 
_dlclose(void * h)379 int _dlclose(void *h)
380 {   TR1("dlclose");
381     return dlclose(h);
382 }
383 
_profil(unsigned short * b,size_t n,size_t o,unsigned int s)384 int _profil(unsigned short *b, size_t n, size_t o, unsigned int s)
385 {   TR1("profil");
386     return profil(b, n, o, s);
387 }
388 
_pthread_create(pthread_t * newthr,pthread_attr_t * attrs,void * (* startup)(void *),void * arg)389 int _pthread_create(pthread_t *newthr, pthread_attr_t *attrs,
390                     void *(*startup)(void *), void *arg)
391 {   TR1("pthread_create");
392     return pthread_create(newthr, attrs, startup, arg);
393 }
394 
_pthread_exit(void * retval)395 void _pthread_exit(void *retval)
396 {   TR1("pthread_x");
397     pthread_exit(retval);
398 }
399 
_pthread_join(pthread_t thr,void ** ret)400 int _pthread_join(pthread_t thr, void **ret)
401 {   TR1("pthread_x");
402     return pthread_join(thr, ret);
403 }
404 
_pthread_detach(pthread_t thr)405 int _pthread_detach(pthread_t thr)
406 {   TR1("pthread_x");
407     return pthread_detach(thr);
408 }
409 
_pthread_self()410 pthread_t _pthread_self()
411 {   TR1("pthread_x");
412     return pthread_self();
413 }
414 
_pthread_equal(pthread_t t1,pthread_t t2)415 int _pthread_equal(pthread_t t1, pthread_t t2)
416 {   TR1("pthread_x");
417     return pthread_equal(t1, t2);
418 }
419 
_pthread_attr_init(pthread_attr_t * atts)420 int _pthread_attr_init(pthread_attr_t *atts)
421 {   TR1("pthread_x");
422     return pthread_attr_init(atts);
423 }
424 
_pthread_attr_destroy(pthread_attr_t * atts)425 int _pthread_attr_destroy(pthread_attr_t *atts)
426 {   TR1("pthread_x");
427     return pthread_attr_destroy(atts);
428 }
429 
_pthread_attr_setdetachstate(pthread_attr_t * atts,int det)430 int _pthread_attr_setdetachstate(pthread_attr_t *atts, int det)
431 {   TR1("pthread_x");
432     return pthread_attr_setdetachstate(atts, det);
433 }
434 
_pthread_attr_getguardsize(const pthread_attr_t * atts,size_t * gs)435 int _pthread_attr_getguardsize(const pthread_attr_t *atts, size_t *gs)
436 {   TR1("pthread_x");
437     return pthread_attr_getguardsize(atts, gs);
438 }
439 
_pthread_attr_setguardsize(pthread_attr_t * atts,size_t gs)440 int _pthread_attr_setguardsize(pthread_attr_t *atts, size_t gs)
441 {   TR1("pthread_x");
442     return pthread_attr_setguardsize(atts, gs);
443 }
444 
_pthread_attr_getschedparam(const pthread_attr_t * atts,struct sched_param * ss)445 int _pthread_attr_getschedparam(const pthread_attr_t *atts, struct sched_param *ss)
446 {   TR1("pthread_x");
447     return pthread_attr_getschedparam(atts, ss);
448 }
449 
_pthread_attr_setschedparam(pthread_attr_t * atts,const struct sched_param * ss)450 int _pthread_attr_setschedparam(pthread_attr_t *atts, const struct sched_param *ss)
451 {   TR1("pthread_x");
452     return pthread_attr_setschedparam(atts, ss);
453 }
454 
_pthread_attr_getschedpolicy(const pthread_attr_t * atts,int * rp)455 int _pthread_attr_getschedpolicy(const pthread_attr_t *atts, int *rp)
456 {   TR1("pthread_x");
457     return pthread_attr_getschedpolicy(atts, rp);
458 }
459 
_pthread_attr_setschedpolicy(pthread_attr_t * atts,int rp)460 int _pthread_attr_setschedpolicy(pthread_attr_t *atts, int rp)
461 {   TR1("pthread_x");
462     return pthread_attr_setschedpolicy(atts, rp);
463 }
464 
_pthread_attr_getinheritsched(const pthread_attr_t * atts,int * ri)465 int _pthread_attr_getinheritsched(const pthread_attr_t *atts, int *ri)
466 {   TR1("pthread_x");
467     return pthread_attr_getinheritsched(atts, ri);
468 }
469 
_pthread_attr_setinheritsched(pthread_attr_t * atts,int ri)470 int _pthread_attr_setinheritsched(pthread_attr_t *atts, int ri)
471 {   TR1("pthread_x");
472     return pthread_attr_setinheritsched(atts, ri);
473 }
474 
_pthread_attr_getscope(const pthread_attr_t * atts,int * rs)475 int _pthread_attr_getscope(const pthread_attr_t *atts, int *rs)
476 {   TR1("pthread_x");
477     return pthread_attr_getscope(atts, rs);
478 }
479 
_pthread_attr_setscope(pthread_attr_t * atts,int rs)480 int _pthread_attr_setscope(pthread_attr_t *atts, int rs)
481 {   TR1("pthread_x");
482     return pthread_attr_setscope(atts, rs);
483 }
484 
_pthread_attr_getstack(pthread_attr_t * attr,void ** a,size_t * s)485 int _pthread_attr_getstack(pthread_attr_t *attr, void **a, size_t *s)
486 {   TR1("pthread_x");
487     return pthread_attr_getstack(attr, a, s);
488 }
489 
_pthread_attr_setstack(pthread_attr_t * attr,void * a,size_t s)490 int _pthread_attr_setstack(pthread_attr_t *attr, void *a, size_t s)
491 {   TR1("pthread_x");
492     return pthread_attr_setstack(attr, a, s);
493 }
494 
_pthread_attr_getstacksize(const pthread_attr_t * attr,size_t * s)495 int _pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *s)
496 {   TR1("pthread_x");
497     return pthread_attr_getstacksize(attr, s);
498 }
499 
_pthread_attr_setstacksize(pthread_attr_t * attr,size_t s)500 int _pthread_attr_setstacksize(pthread_attr_t *attr, size_t s)
501 {   TR1("pthread_x");
502     return pthread_attr_setstacksize(attr, s);
503 }
504 
_pthread_setschedparam(pthread_t t,int pol,const struct sched_param * p)505 int _pthread_setschedparam(pthread_t t, int pol, const struct sched_param *p)
506 {   TR1("pthread_x");
507     return pthread_setschedparam(t, pol, p);
508 }
509 
_pthread_getschedparam(pthread_t t,int * pol,struct sched_param * p)510 int _pthread_getschedparam(pthread_t t, int *pol, struct sched_param *p)
511 {   TR1("pthread_x");
512     return pthread_getschedparam(t, pol, p);
513 }
514 
_pthread_setschedprio(pthread_t t,int p)515 int _pthread_setschedprio(pthread_t t, int p)
516 {   TR1("pthread_x");
517     return pthread_setschedprio(t, p);
518 }
519 
_pthread_getconcurrency()520 int _pthread_getconcurrency()
521 {   TR1("pthread_x");
522     return pthread_getconcurrency();
523 }
524 
_pthread_yield()525 int _pthread_yield()
526 {   TR1("pthread_x");
527     return pthread_yield();
528 }
529 
_pthread_setaffinity_np(pthread_t t,size_t n,const cpu_set_t * c)530 int _pthread_setaffinity_np(pthread_t t, size_t n, const cpu_set_t *c)
531 {   TR1("pthread_x");
532     return pthread_setaffinity_np(t, n, c);
533 }
534 
_pthread_getaffinity_np(pthread_t t,size_t n,cpu_set_t * c)535 int _pthread_getaffinity_np(pthread_t t, size_t n, cpu_set_t *c)
536 {   TR1("pthread_x");
537     return pthread_getaffinity_np(t, n, c);
538 }
539 
_pthread_once(pthread_once_t * t,void (* i)())540 int _pthread_once(pthread_once_t *t, void (*i)())
541 {   TR1("pthread_x");
542     return pthread_once(t, i);
543 }
544 
_pthread_setcancelstate(int s,int * o)545 int _pthread_setcancelstate(int s, int *o)
546 {   TR1("pthread_x");
547     return pthread_setcancelstate(s, o);
548 }
549 
_pthread_setcanceltype(int t,int * o)550 int _pthread_setcanceltype(int t, int *o)
551 {   TR1("pthread_x");
552     return pthread_setcanceltype(t, o);
553 }
554 
_pthread_cancel(pthread_t t)555 int _pthread_cancel(pthread_t t)
556 {   TR1("pthread_x");
557     return pthread_cancel(t);
558 }
559 
_pthread_testcancel()560 void _pthread_testcancel()
561 {   TR1("pthread_x");
562     pthread_testcancel();
563 }
564 
_pthread_mutex_init(pthread_mutex_t * m,const pthread_mutexattr_t * a)565 int _pthread_mutex_init(pthread_mutex_t *m, const pthread_mutexattr_t *a)
566 {   TR1("pthread_x");
567     return pthread_mutex_init(m, a);
568 }
569 
_pthread_mutex_destroy(pthread_mutex_t * m)570 int _pthread_mutex_destroy(pthread_mutex_t *m)
571 {   TR1("pthread_x");
572     return pthread_mutex_destroy(m);
573 }
574 
_pthread_mutex_trylock(pthread_mutex_t * m)575 int _pthread_mutex_trylock(pthread_mutex_t *m)
576 {   TR1("pthread_x");
577     return pthread_mutex_trylock(m);
578 }
579 
_pthread_mutex_lock(pthread_mutex_t * m)580 int _pthread_mutex_lock(pthread_mutex_t *m)
581 {   TR1("pthread_x");
582     return pthread_mutex_lock(m);
583 }
584 
_pthread_mutex_unlock(pthread_mutex_t * m)585 int _pthread_mutex_unlock(pthread_mutex_t *m)
586 {   TR1("pthread_x");
587     return pthread_mutex_unlock(m);
588 }
589 
_pthread_mutexattr_init(pthread_mutexattr_t * m)590 int _pthread_mutexattr_init(pthread_mutexattr_t *m)
591 {   TR1("pthread_x");
592     return pthread_mutexattr_init(m);
593 }
594 
_pthread_mutexattr_destroy(pthread_mutexattr_t * a)595 int _pthread_mutexattr_destroy(pthread_mutexattr_t *a)
596 {   TR1("pthread_x");
597     return pthread_mutexattr_destroy(a);
598 }
599 
_pthread_mutexattr_getpshared(const pthread_mutexattr_t * a,int * p)600 int _pthread_mutexattr_getpshared(const pthread_mutexattr_t *a, int *p)
601 {   TR1("pthread_x");
602     return pthread_mutexattr_getpshared(a, p);
603 }
604 
_pthread_mutexattr_setpshared(pthread_mutexattr_t * a,int p)605 int _pthread_mutexattr_setpshared(pthread_mutexattr_t *a, int p)
606 {   TR1("pthread_x");
607     return pthread_mutexattr_setpshared(a, p);
608 }
609 
_pthread_rwlock_unlock(pthread_rwlock_t * r)610 int _pthread_rwlock_unlock(pthread_rwlock_t *r)
611 {   TR1("pthread_x");
612     return pthread_rwlock_unlock(r);
613 }
614 
_pthread_rwlockattr_init(pthread_rwlockattr_t * a)615 int _pthread_rwlockattr_init(pthread_rwlockattr_t *a)
616 {   TR1("pthread_x");
617     return pthread_rwlockattr_init(a);
618 }
619 
_pthread_rwlockattr_destroy(pthread_rwlockattr_t * a)620 int _pthread_rwlockattr_destroy(pthread_rwlockattr_t *a)
621 {   TR1("pthread_x");
622     return pthread_rwlockattr_destroy(a);
623 }
624 
_pthread_rwlockattr_getpshared(const pthread_rwlockattr_t * a,int * p)625 int _pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *a, int *p)
626 {   TR1("pthread_x");
627     return pthread_rwlockattr_getpshared(a, p);
628 }
629 
_pthread_rwlockattr_setpshared(pthread_rwlockattr_t * a,int p)630 int _pthread_rwlockattr_setpshared(pthread_rwlockattr_t *a, int p)
631 {   TR1("pthread_x");
632     return pthread_rwlockattr_setpshared(a, p);
633 }
634 
_pthread_rwlockattr_getkind_np(const pthread_rwlockattr_t * a,int * p)635 int _pthread_rwlockattr_getkind_np(const pthread_rwlockattr_t *a, int *p)
636 {   TR1("pthread_x");
637     return pthread_rwlockattr_getkind_np(a, p);
638 }
639 
_pthread_rwlockattr_setkind_np(pthread_rwlockattr_t * a,int p)640 int _pthread_rwlockattr_setkind_np(pthread_rwlockattr_t *a, int p)
641 {   TR1("pthread_x");
642     return pthread_rwlockattr_setkind_np(a, p);
643 }
644 
_pthread_cond_init(pthread_cond_t * c,const pthread_condattr_t * a)645 int _pthread_cond_init(pthread_cond_t *c, const pthread_condattr_t *a)
646 {   TR1("pthread_x");
647     return pthread_cond_init(c, a);
648 }
649 
_pthread_cond_destroy(pthread_cond_t * c)650 int _pthread_cond_destroy(pthread_cond_t *c)
651 {   TR1("pthread_x");
652     return pthread_cond_destroy(c);
653 }
654 
_pthread_cond_signal(pthread_cond_t * c)655 int _pthread_cond_signal(pthread_cond_t *c)
656 {   TR1("pthread_x");
657     return pthread_cond_signal(c);
658 }
659 
_pthread_cond_broadcast(pthread_cond_t * c)660 int _pthread_cond_broadcast(pthread_cond_t *c)
661 {   TR1("pthread_x");
662     return pthread_cond_broadcast(c);
663 }
664 
_pthread_cond_wait(pthread_cond_t * c,pthread_mutex_t * m)665 int _pthread_cond_wait(pthread_cond_t *c, pthread_mutex_t *m)
666 {   TR1("pthread_x");
667     return pthread_cond_wait(c, m);
668 }
669 
_pthread_cond_timedwait(pthread_cond_t * c,pthread_mutex_t * m,const struct timespec * t)670 int _pthread_cond_timedwait(pthread_cond_t *c, pthread_mutex_t *m, const struct timespec *t)
671 {   TR1("pthread_x");
672     return pthread_cond_timedwait(c, m, t);
673 }
674 
_pthread_condattr_init(pthread_condattr_t * a)675 int _pthread_condattr_init(pthread_condattr_t *a)
676 {   TR1("pthread_x");
677     return pthread_condattr_init(a);
678 }
679 
_pthread_condattr_destroy(pthread_condattr_t * a)680 int _pthread_condattr_destroy(pthread_condattr_t *a)
681 {   TR1("pthread_x");
682     return pthread_condattr_destroy(a);
683 }
684 
_pthread_condattr_getpshared(pthread_condattr_t * a,int * s)685 int _pthread_condattr_getpshared(pthread_condattr_t *a, int *s)
686 {   TR1("pthread_x");
687     return pthread_condattr_getpshared(a, s);
688 }
689 
_pthread_condattr_setpshared(pthread_condattr_t * a,int s)690 int _pthread_condattr_setpshared(pthread_condattr_t *a, int s)
691 {   TR1("pthread_x");
692     return pthread_condattr_setpshared(a, s);
693 }
694 
_pthread_key_create(pthread_key_t * k,void (* d)(void *))695 int _pthread_key_create(pthread_key_t *k, void (*d)(void *))
696 {   TR1("pthread_x");
697     return pthread_key_create(k, d);
698 }
699 
_pthread_key_delete(pthread_key_t k)700 int _pthread_key_delete(pthread_key_t k)
701 {   TR1("pthread_x");
702     return pthread_key_delete(k);
703 }
704 
_pthread_getspecific(pthread_key_t k)705 void *_pthread_getspecific(pthread_key_t k)
706 {   TR1("pthread_x");
707     return pthread_getspecific(k);
708 }
709 
_pthread_setspecific(pthread_key_t k,const void * p)710 int _pthread_setspecific(pthread_key_t k, const void *p)
711 {   TR1("pthread_x");
712     return pthread_setspecific(k, p);
713 }
714 
_pthread_atfork(void (* prep)(),void (* par)(),void (* chi)())715 int _pthread_atfork(void (*prep)(), void (*par)(), void (*chi)())
716 {   TR1("pthread_x");
717     return pthread_atfork(prep, par, chi);
718 }
719 
720 #endif /* __linux__ */
721 
722 #ifdef __WIN64__
723 
724 #endif
725 
726 /* end of pslstubs.c */
727 
728