-
Notifications
You must be signed in to change notification settings - Fork 23
/
tlib.cxx
811 lines (688 loc) · 18.3 KB
/
tlib.cxx
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
/*
* tlib.cxx
*
* Miscelaneous class implementation
*
* Portable Windows Library
*
* Copyright (c) 1993-1998 Equivalence Pty. Ltd.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Portable Windows Library.
*
* The Initial Developer of the Original Code is Equivalence Pty. Ltd.
*
* Portions are Copyright (C) 1993 Free Software Foundation, Inc.
* All Rights Reserved.
*
* Contributor(s): ______________________________________.
*
* $Revision$
* $Author$
* $Date$
*/
#define _OSUTIL_CXX
//#define SIGNALS_DEBUG
#pragma implementation "args.h"
#pragma implementation "pprocess.h"
#pragma implementation "thread.h"
#pragma implementation "semaphor.h"
#pragma implementation "mutex.h"
#pragma implementation "critsec.h"
#pragma implementation "psync.h"
#pragma implementation "syncpoint.h"
#pragma implementation "syncthrd.h"
#include "ptlib.h"
#include <ptlib/pprocess.h>
#ifdef P_VXWORKS
#include <sys/times.h>
#include <time.h>
#include <hostLib.h>
#include <remLib.h>
#include <taskLib.h>
#include <intLib.h>
#else
#include <sys/time.h>
#include <pwd.h>
#include <grp.h>
#endif // P_VXWORKS
#include <signal.h>
#include <sys/wait.h>
#include <errno.h>
#if defined(P_LINUX) || defined(P_GNU_HURD)
#include <sys/cdefs.h>
#include <sys/types.h>
#include <sys/mman.h>
#endif
#if defined(P_LINUX) || defined(P_SUN4) || defined(P_SOLARIS) || defined(P_FREEBSD) || defined(P_OPENBSD) || defined(P_NETBSD) || defined(P_MACOSX) || defined(P_MACOS) || defined (P_AIX) || defined(P_BEOS) || defined(P_IRIX) || defined(P_QNX) || defined(P_GNU_HURD)
#include <sys/utsname.h>
#define HAS_UNAME
#elif defined(P_RTEMS)
extern "C" {
#include <sys/utsname.h>
}
#define HAS_UNAME
#endif
#include "uerror.h"
#if defined(P_HPUX9)
#define SELECT(p1,p2,p3,p4,p5) select(p1,(int *)(p2),(int *)(p3),(int *)(p4),p5)
#else
#define SELECT(p1,p2,p3,p4,p5) select(p1,p2,p3,p4,p5)
#endif
#if defined(P_SUN4)
extern "C" void bzero(void *, int);
extern "C" int select(int width,
fd_set *readfds,
fd_set *writefds,
fd_set *exceptfds,
struct timeval *timeout);
#endif
#ifdef P_BEOS
#include "OS.h"
#endif
PString PProcess::GetOSClass()
{
#ifndef P_BEOS
return PString("Unix");
#elif defined P_VXWORKS
return PString("VxWorks");
#else
return PString("Be Inc.");
#endif
}
PString PProcess::GetOSName()
{
#if defined(HAS_UNAME)
struct utsname info;
uname(&info);
#ifdef P_SOLARIS
return PString(info.sysname) & info.release;
#else
return PString(info.sysname);
#endif
#elif defined(P_VXWORKS)
return PString::Empty();
#else
#warning No GetOSName specified
return PString("Unknown");
#endif
}
PString PProcess::GetOSHardware()
{
#if defined(HAS_UNAME)
struct utsname info;
uname(&info);
return PString(info.machine);
#elif defined(P_VXWORKS)
return PString(sysModel());
#else
#warning No GetOSHardware specified
return PString("unknown");
#endif
}
PString PProcess::GetOSVersion()
{
#if defined(HAS_UNAME)
struct utsname info;
uname(&info);
#ifdef P_SOLARIS
return PString(info.version);
#else
return PString(info.release);
#endif
#elif defined(P_VXWORKS)
return PString(sysBspRev());
#else
#warning No GetOSVersion specified
return PString("?.?");
#endif
}
bool PProcess::IsOSVersion(unsigned major, unsigned minor, unsigned build)
{
#if defined(HAS_UNAME)
struct utsname info;
uname(&info);
unsigned maj, min, bld;
sscanf(
#ifdef P_SOLARIS
info.version
#else
info.release
#endif
, "%u.%u.%u", &maj, &min, &bld);
if (maj < major)
return false;
if (maj > major)
return true;
if (min < minor)
return false;
if (min > minor)
return true;
return bld >= build;
#elif defined(P_VXWORKS)
return sysBspRev() >= major;
#else
return true;
#endif
}
PDirectory PProcess::GetOSConfigDir()
{
#ifdef P_VXWORKS
return "./";
#else
return "/etc";
#endif // P_VXWORKS
}
PDirectory PProcess::PXGetHomeDir ()
{
#ifdef P_VXWORKS
return "./";
#else
PString dest;
char *ptr;
struct passwd *pw = NULL;
#if defined(P_PTHREADS) && !defined(P_THREAD_SAFE_CLIB)
struct passwd pwd;
char buffer[1024];
#if defined (P_LINUX) || defined(P_AIX) || defined(P_IRIX) || (__GNUC__>=3 && defined(P_SOLARIS)) || defined(P_RTEMS) || defined(P_GNU_HURD)
::getpwuid_r(geteuid(), &pwd,
buffer, 1024,
&pw);
#else
pw = ::getpwuid_r(geteuid(), &pwd, buffer, 1024);
#endif
#else
pw = ::getpwuid(geteuid());
#endif
if (pw != NULL && pw->pw_dir != NULL)
dest = pw->pw_dir;
else if ((ptr = getenv ("HOME")) != NULL)
dest = ptr;
else
dest = ".";
if (dest.GetLength() > 0 && dest[dest.GetLength()-1] != '/')
dest += "/";
return dest;
#endif
}
///////////////////////////////////////////////////////////////////////////////
//
// PProcess
//
// Return the effective user name of the process, eg "root" etc.
PString PProcess::GetUserName() const
{
#ifdef P_VXWORKS
char pnamebuf[1024];
int len = 1024;
STATUS gethostresult;
gethostresult =::gethostname(pnamebuf,len);
if (gethostresult == OK)
return PString(pnamebuf,len);
else
return PString("VxWorks");
#else
#if defined(P_PTHREADS) && !defined(P_THREAD_SAFE_CLIB)
struct passwd pwd;
char buffer[1024];
struct passwd * pw = NULL;
#if defined (P_LINUX) || defined (P_AIX) || defined(P_IRIX) || (__GNUC__>=3 && defined(P_SOLARIS)) || defined(P_RTEMS) || defined(P_GNU_HURD)
::getpwuid_r(geteuid(), &pwd, buffer, 1024, &pw);
#else
pw = ::getpwuid_r(geteuid(), &pwd, buffer, 1024);
#endif
#else
struct passwd * pw = ::getpwuid(geteuid());
#endif
char * ptr;
if (pw != NULL && pw->pw_name != NULL)
return PString(pw->pw_name);
else if ((ptr = getenv("USER")) != NULL)
return PString(ptr);
else
return PString("user");
#endif // P_VXWORKS
}
PBoolean PProcess::SetUserName(const PString & username, PBoolean permanent)
{
#ifdef P_VXWORKS
PAssertAlways("PProcess::SetUserName - not implemented for VxWorks");
return PFalse;
#else
if (username.IsEmpty())
return seteuid(getuid()) != -1;
int uid = -1;
if (username[0] == '#') {
PString s = username.Mid(1);
if (s.FindSpan("1234567890") == P_MAX_INDEX)
uid = s.AsInteger();
}
else {
#if defined(P_PTHREADS) && !defined(P_THREAD_SAFE_CLIB)
struct passwd pwd;
char buffer[1024];
struct passwd * pw = NULL;
#if defined (P_LINUX) || defined (P_AIX) || defined(P_IRIX) || (__GNUC__>=3 && defined(P_SOLARIS)) || defined(P_RTEMS) || defined(P_GNU_HURD)
::getpwnam_r(username, &pwd, buffer, 1024, &pw);
#else
pw = ::getpwnam_r(username, &pwd, buffer, 1024);
#endif
#else
struct passwd * pw = ::getpwnam(username);
#endif
if (pw != NULL && pw->pw_name != NULL)
uid = pw->pw_uid;
else {
if (username.FindSpan("1234567890") == P_MAX_INDEX)
uid = username.AsInteger();
}
}
if (uid < 0)
return PFalse;
if (permanent)
return setuid(uid) != -1;
return seteuid(uid) != -1;
#endif // P_VXWORKS
}
///////////////////////////////////////////////////////////////////////////////
//
// PProcess
//
// Return the effective group name of the process, eg "wheel" etc.
PString PProcess::GetGroupName() const
{
#ifdef P_VXWORKS
return PString("VxWorks");
#else
#if defined(P_PTHREADS) && !defined(P_THREAD_SAFE_CLIB)
struct group grp;
char buffer[1024];
struct group * gr = NULL;
#if defined (P_LINUX) || defined (P_AIX) || defined(P_IRIX) || (__GNUC__>=3 && defined(P_SOLARIS)) || defined(P_RTEMS) || defined(P_GNU_HURD)
(void)::getgrgid_r(getegid(), &grp, buffer, 1024, &gr);
#else
gr = ::getgrgid_r(getegid(), &grp, buffer, 1024);
#endif
#else
struct group * gr = ::getgrgid(getegid());
#endif
char * ptr;
if (gr != NULL && gr->gr_name != NULL)
return PString(gr->gr_name);
else if ((ptr = getenv("GROUP")) != NULL)
return PString(ptr);
else
return PString("group");
#endif // P_VXWORKS
}
PBoolean PProcess::SetGroupName(const PString & groupname, PBoolean permanent)
{
#ifdef P_VXWORKS
PAssertAlways("PProcess::SetGroupName - not implemented for VxWorks");
return PFalse;
#else
if (groupname.IsEmpty())
return setegid(getgid()) != -1;
int gid = -1;
if (groupname[0] == '#') {
PString s = groupname.Mid(1);
if (s.FindSpan("1234567890") == P_MAX_INDEX)
gid = s.AsInteger();
}
else {
#if defined(P_PTHREADS) && !defined(P_THREAD_SAFE_CLIB)
struct group grp;
char buffer[1024];
struct group * gr = NULL;
#if defined (P_LINUX) || defined (P_AIX) || defined(P_IRIX) || (__GNUC__>=3 && defined(P_SOLARIS)) || defined(P_RTEMS) || defined(P_GNU_HURD)
(void)::getgrnam_r(groupname, &grp, buffer, 1024, &gr);
#else
gr = ::getgrnam_r(groupname, &grp, buffer, 1024);
#endif
#else
struct group * gr = ::getgrnam(groupname);
#endif
if (gr != NULL && gr->gr_name != NULL)
gid = gr->gr_gid;
else {
if (groupname.FindSpan("1234567890") == P_MAX_INDEX)
gid = groupname.AsInteger();
}
}
if (gid < 0)
return PFalse;
if (permanent)
return setgid(gid) != -1;
return setegid(gid) != -1;
#endif // P_VXWORKS
}
extern PProcess * PProcessInstance;;
PString PX_GetThreadName(pthread_t id)
{
if (PProcessInstance != NULL) {
PWaitAndSignal m(PProcessInstance->m_activeThreadMutex);
PThread * thread = PProcessInstance->m_activeThreads[id];
return thread->GetThreadName();
}
return psprintf("%08x", id);
}
void PProcess::PXShowSystemWarning(PINDEX num)
{
PXShowSystemWarning(num, "");
}
void PProcess::PXShowSystemWarning(PINDEX num, const PString & str)
{
PProcess::Current()._PXShowSystemWarning(num, str);
}
void PProcess::_PXShowSystemWarning(PINDEX code, const PString & str)
{
PError << "PWLib " << GetOSClass() << " error #" << code << '-' << str << endl;
}
void PXSignalHandler(int sig)
{
#ifdef SIGNALS_DEBUG
fprintf(stderr,"\nSIGNAL<%u>\n", (unsigned int)sig);
#endif
PProcess & process = PProcess::Current();
process.pxSignals |= 1 << sig;
process.PXOnAsyncSignal(sig);
#if defined(P_MAC_MPTHREADS)
process.SignalTimerChange();
#elif defined(P_PTHREADS)
// Inform house keeping thread we have a signal to be processed
process.SignalTimerChange();
#endif
signal(sig, PXSignalHandler);
}
void PProcess::PXCheckSignals()
{
if (pxSignals == 0)
return;
#ifdef SIGNALS_DEBUG
fprintf(stderr,"\nCHKSIG<%x>\n",pxSignals);
#endif
for (int sig = 0; sig < 32; sig++) {
int bit = 1 << sig;
if ((pxSignals&bit) != 0) {
pxSignals &= ~bit;
PXOnSignal(sig);
}
}
}
void SetSignals(void (*handler)(int))
{
#ifdef SIGNALS_DEBUG
fprintf(stderr,"\nSETSIG<%x>\n",(INT)handler);
#endif
if (handler == NULL)
handler = SIG_DFL;
#ifdef SIGHUP
signal(SIGHUP, handler);
#endif
#ifdef SIGINT
signal(SIGINT, handler);
#endif
#ifdef SIGUSR1
signal(SIGUSR1, handler);
#endif
#ifdef SIGUSR2
signal(SIGUSR2, handler);
#endif
#ifdef SIGPIPE
signal(SIGPIPE, handler);
#endif
#ifdef SIGTERM
signal(SIGTERM, handler);
#endif
#ifdef SIGWINCH
signal(SIGWINCH, handler);
#endif
#ifdef SIGPROF
signal(SIGPROF, handler);
#endif
}
void PProcess::PXOnAsyncSignal(int sig)
{
#ifdef SIGNALS_DEBUG
fprintf(stderr,"\nASYNCSIG<%u>\n",sig);
#endif
switch (sig) {
case SIGINT:
case SIGTERM:
if (OnInterrupt(sig == SIGTERM))
break;
// Do next case
case SIGHUP:
raise(SIGKILL);
break;
default:
return;
}
}
void PProcess::PXOnSignal(int sig)
{
#ifdef _DEBUG
#ifdef SIGNALS_DEBUG
fprintf(stderr,"\nSYNCSIG<%u>\n",sig);
#endif
if (sig == 28) {
#if PMEMORY_CHECK
PBoolean oldIgnore = PMemoryHeap::SetIgnoreAllocations(PTrue);
static PMemoryHeap::State state;
PMemoryHeap::GetState(state);
#endif
PStringStream strm;
m_activeThreadMutex.Wait();
strm << "===============\n"
<< m_activeThreads.size() << " active threads\n";
for (ThreadMap::iterator it = m_activeThreads.begin(); it != m_activeThreads.end(); ++it)
strm << " " << *it->second << "\n";
#if PMEMORY_CHECK
strm << "---------------\n";
PMemoryHeap::DumpObjectsSince(state, strm);
PMemoryHeap::GetState(state);
#endif
strm << "===============\n";
m_activeThreadMutex.Signal();
fprintf(stderr, "%s", strm.GetPointer());
#if PMEMORY_CHECK
PMemoryHeap::SetIgnoreAllocations(oldIgnore);
#endif
}
#endif
}
void PProcess::CommonConstruct()
{
// Setup signal handlers
pxSignals = 0;
if (!m_library)
SetSignals(&PXSignalHandler);
#if !defined(P_VXWORKS) && !defined(P_RTEMS)
// initialise the timezone information
tzset();
#endif
#ifdef P_CONFIG_FILE
CreateConfigFilesDictionary();
#endif
}
void PProcess::CommonDestruct()
{
#ifdef P_CONFIG_FILE
delete configFiles;
#endif
configFiles = NULL;
if (!m_library)
SetSignals(NULL);
}
// rtems fixes
#ifdef P_RTEMS
extern "C" {
#include <netinet/in.h>
#include <rtems/rtems_bsdnet.h>
int socketpair(int d, int type, int protocol, int sv[2])
{
static int port_count = IPPORT_USERRESERVED;
int s;
int addrlen;
struct sockaddr_in addr1, addr2;
static int network_status = 1;
if (network_status>0)
{
printf("\"Network\" initializing!\n");
network_status = rtems_bsdnet_initialize_network();
if (network_status == 0)
printf("\"Network\" initialized!\n");
else
{
printf("Error: %s\n", strerror(errno));
return -1;
}
}
/* prepare sv */
sv[0]=sv[1]=-1;
/* make socket */
s = socket( d, type, protocol);
if (s<0)
return -1;
memset(&addr1, 0, sizeof addr1);
addr1.sin_family = d;
addr1.sin_port = htons(++port_count);
addr1.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
if (bind(s, (struct sockaddr *)&addr1, sizeof addr1) < 0)
{
close(s);
return -1;
}
if (listen(s, 2) < 0 )
{
close(s);
return -1;
}
sv[0] = socket(d, type, protocol);
if (sv[0] < 0)
{
close(s);
return -1;
}
memset(&addr2, 0, sizeof addr2);
addr2.sin_family = d;
addr2.sin_port = htons(++port_count);
addr2.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
if (bind(sv[0], (struct sockaddr *)&addr2, sizeof addr2) < 0)
{
close(s);
close(sv[0]);
sv[0]=-1;
return -1;
}
if (connect(sv[0], (struct sockaddr *)&addr1, sizeof addr1) < 0)
{
close(s);
close(sv[0]);
sv[0]=-1;
return -1;
}
sv[1] = accept(s, (struct sockaddr *)&addr2, &addrlen);
if (sv[1] < 0)
{
close(s);
close(sv[0]);
sv[0]=-1;
return -1;
}
close(s);
return 0;
}
/*
* Loopback interface
*/
extern int rtems_bsdnet_loopattach(rtems_bsdnet_ifconfig *);
static struct rtems_bsdnet_ifconfig loopback_config = {
"lo0", /* name */
rtems_bsdnet_loopattach, /* attach function */
NULL, /* link to next interface */
"127.0.0.1", /* IP address */
"255.0.0.0", /* IP net mask */
};
#include <bsp.h>
#warning Change lines below to match Your system settings
/*
* Default network interface
*/
static struct rtems_bsdnet_ifconfig netdriver_config = {
RTEMS_BSP_NETWORK_DRIVER_NAME, /* name */
RTEMS_BSP_NETWORK_DRIVER_ATTACH, /* attach function */
&loopback_config, /* link to next interface */
"10.0.0.2", /* IP address */
"255.255.255.0", /* IP net mask */
NULL, /* Driver supplies hardware address */
0 /* Use default driver parameters */
};
/*
* Network configuration
*/
struct rtems_bsdnet_config rtems_bsdnet_config = {
&netdriver_config,
NULL, /* no bootp function */
1, /* Default network task priority */
0, /* Default mbuf capacity */
0, /* Default mbuf cluster capacity */
"computer.name", /* Host name */
"domain.name", /* Domain name */
"10.0.0.1", /* Gateway */
"10.0.0.1", /* Log host */
{"10.0.0.1" }, /* Name server(s) */
{"10.0.0.1" }, /* NTP server(s) */
};
#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
#define CONFIGURE_MICROSECONDS_PER_TICK 1000
#define CONFIGURE_TICKS_PER_TIMESLICE 50
#define CONFIGURE_MAXIMUM_TASKS rtems_resource_unlimited(50)
#define CONFIGURE_MAXIMUM_TIMERS rtems_resource_unlimited(50)
#define CONFIGURE_MAXIMUM_SEMAPHORES rtems_resource_unlimited(50)
#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES rtems_resource_unlimited(50)
#define CONFIGURE_MAXIMUM_MUTEXES rtems_resource_unlimited(50)
#define CONFIGURE_MAXIMUM_POSIX_THREADS 500
#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 500
#define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES 500
#define CONFIGURE_MAXIMUM_POSIX_KEYS 500
#define CONFIGURE_MAXIMUM_POSIX_TIMERS 500
#define CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS 500
#define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES 500
#define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES 500
#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 500
#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
#define CONFIGURE_INIT_TASK_INITIAL_MODES (RTEMS_PREEMPT | RTEMS_TIMESLICE)
#ifdef DEBUG
#define STACK_CHECKER_ON
#endif
void* POSIX_Init(void*);
#define CONFIGURE_INIT
#include <confdefs.h>
}
#endif // P_RTEMS
//////////////////////////////////////////////////////////////////
//
// Non-PTHREAD based routines
//
#if defined(P_MAC_MPTHREADS)
#include "tlibmpthrd.cxx"
#elif defined(P_PTHREADS)
#include "tlibthrd.cxx"
#elif defined(BE_THREADS)
#include "tlibbe.cxx"
#elif defined(VX_TASKS)
#include "tlibvx.cxx"
#endif