4 * Miscelaneous class implementation
6 * Portable Windows Library
8 * Copyright (c) 1993-1998 Equivalence Pty. Ltd.
10 * The contents of this file are subject to the Mozilla Public License
11 * Version 1.0 (the "License"); you may not use this file except in
12 * compliance with the License. You may obtain a copy of the License at
13 * http://www.mozilla.org/MPL/
15 * Software distributed under the License is distributed on an "AS IS"
16 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17 * the License for the specific language governing rights and limitations
20 * The Original Code is Portable Windows Library.
22 * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
24 * Portions are Copyright (C) 1993 Free Software Foundation, Inc.
25 * All Rights Reserved.
27 * Contributor(s): ______________________________________.
30 * Revision 1.83 2007/07/09 00:13:27 csoutheren
31 * Fix compile on MacOSX
33 * Revision 1.82 2007/07/06 02:12:14 csoutheren
34 * Add extra memory leak debugging on Linux
35 * Remove compile warnings
37 * Revision 1.81 2007/06/29 02:47:28 rjongbloed
38 * Added PString::FindSpan() function (strspn equivalent) with slightly nicer semantics.
40 * Revision 1.80 2007/05/01 10:20:44 csoutheren
41 * Applied 1703617 - Prevention of application deadlock caused by too many timers
42 * Thanks to Fabrizio Ammollo
44 * Revision 1.79 2006/07/14 04:55:10 csoutheren
45 * Applied 1520151 - Adds PID to tracefile + Rolling Date pattern
46 * Thanks to Paul Nader
48 * Revision 1.78 2006/06/21 13:27:03 csoutheren
49 * Fixed link problem with gcc 2.95.3
51 * Revision 1.77 2006/06/21 03:28:44 csoutheren
52 * Various cleanups thanks for Frederic Heem
54 * Revision 1.76 2005/11/30 12:47:42 csoutheren
55 * Removed tabs, reformatted some code, and changed tags for Doxygen
57 * Revision 1.75 2005/11/08 10:35:53 csoutheren
58 * Added missing pragma
60 * Revision 1.74 2005/08/04 18:54:10 csoutheren
61 * Applied fix for bug Bugs item #1244310
62 * Fix problem wioth --disable-openh323 option
63 * Thanks to Michael Manousos
65 * Revision 1.73 2005/02/22 03:25:43 dereksmithies
66 * Add fix from huangzb@a-star.com.cn to correct a typo. Many thanks.
68 * Revision 1.72 2005/01/26 05:38:05 csoutheren
69 * Added ability to remove config file support
71 * Revision 1.71 2005/01/04 08:09:43 csoutheren
72 * Fixed Linux configure problems
74 * Revision 1.70 2004/07/11 07:56:36 csoutheren
75 * Applied jumbo VxWorks patch, thanks to Eize Slange
77 * Revision 1.69 2003/09/18 23:52:08 dereksmithies
78 * Fix checks on NULL pointers. Many thanks to Chris Rankin.
80 * Revision 1.68 2003/09/17 01:18:04 csoutheren
81 * Removed recursive include file system and removed all references
82 * to deprecated coooperative threading support
84 * Revision 1.67 2003/01/24 10:21:06 robertj
85 * Fixed issues in RTEMS support, thanks Vladimir Nesic
87 * Revision 1.66 2002/12/11 23:02:39 robertj
88 * Added ability to set user identity temporarily and permanently.
89 * Added ability to have username exclusively digits which corresponds to a uid.
90 * Added get and set users group functions.
92 * Revision 1.65 2002/12/02 03:57:18 robertj
93 * More RTEMS support patches, thank you Vladimir Nesic.
95 * Revision 1.64 2002/11/22 10:14:07 robertj
96 * QNX port, thanks Xiaodan Tang
98 * Revision 1.63 2002/11/02 00:32:21 robertj
99 * Further fixes to VxWorks (Tornado) port, thanks Andreas Sikkema.
101 * Revision 1.62 2002/10/17 13:44:27 robertj
102 * Port to RTEMS, thanks Vladimir Nesic.
104 * Revision 1.61 2002/10/10 04:43:44 robertj
105 * VxWorks port, thanks Martijn Roest
107 * Revision 1.60 2002/06/27 08:09:06 robertj
108 * GNU GCC 3.1 compatibility under Solaris
110 * Revision 1.59 2001/11/25 23:30:31 robertj
111 * Added PProcess::SetUserName() function to set euid
113 * Revision 1.58 2001/10/11 02:20:54 robertj
114 * Added IRIX support (no audio/video), thanks Andre Schulze.
116 * Revision 1.57 2001/09/18 05:56:03 robertj
117 * Fixed numerous problems with thread suspend/resume and signals handling.
119 * Revision 1.56 2001/08/11 15:38:43 rogerh
120 * Add Mac OS Carbon changes from John Woods <jfw@jfwhome.funhouse.com>
122 * Revision 1.55 2001/06/30 06:59:07 yurik
123 * Jac Goudsmit from Be submit these changes 6/28. Implemented by Yuri Kiryanov
125 * Revision 1.54 2001/03/29 03:24:31 robertj
126 * Removed capture of SIGQUIT so can still dro a core on demand.
128 * Revision 1.53 2001/03/14 01:16:11 robertj
129 * Fixed signals processing, now uses housekeeping thread to handle signals
130 * synchronously. This also fixes issues with stopping PServiceProcess.
132 * Revision 1.52 2001/03/07 07:31:25 yurik
133 * refined BeOS constants
135 * Revision 1.51 2000/06/21 01:01:22 robertj
136 * AIX port, thanks Wolfgang Platzer (wolfgang.platzer@infonova.at).
138 * Revision 1.50 2000/04/09 18:19:23 rogerh
139 * Add my changes for NetBSD support.
141 * Revision 1.49 2000/04/06 12:19:49 rogerh
142 * Add Mac OS X support submitted by Kevin Packard
144 * Revision 1.48 2000/03/08 12:17:09 rogerh
145 * Add OpenBSD support
147 * Revision 1.47 1999/09/03 02:26:25 robertj
148 * Changes to aid in breaking I/O locks on thread termination. Still needs more work esp in BSD!
150 * Revision 1.46 1999/07/19 01:32:24 craigs
151 * Changed signals used in pthreads code, is used by linux version.
153 * Revision 1.45 1999/07/11 13:42:13 craigs
154 * pthreads support for Linux
156 * Revision 1.44 1999/06/28 09:28:02 robertj
157 * Portability issues, especially n BeOS (thanks Yuri!)
159 * Revision 1.43 1999/05/13 04:44:18 robertj
160 * Added SIGHUP and SIGWINCH handlers to increase and decrease the log levels.
162 * Revision 1.42 1999/03/02 05:41:59 robertj
165 * Revision 1.41 1999/02/26 04:10:39 robertj
166 * More BeOS port changes
168 * Revision 1.40 1999/02/19 11:34:15 robertj
169 * Added platform dependent function for "system configuration" directory.
171 * Revision 1.39 1999/02/06 05:49:44 robertj
172 * BeOS port effort by Yuri Kiryanov <openh323@kiryanov.com>
174 * Revision 1.38 1999/01/11 12:10:39 robertj
175 * Improved operating system version display.
177 * Revision 1.37 1999/01/08 01:31:01 robertj
178 * Support for pthreads under FreeBSD
180 * Revision 1.36 1998/11/24 11:24:40 robertj
181 * Added FreeBSD OSName
183 * Revision 1.35 1998/11/24 09:39:16 robertj
186 * Revision 1.34 1998/10/31 14:14:21 robertj
187 * Changed syncptack.h to syncthrd.h for more thread synchronisation objects.
189 * Revision 1.33 1998/10/19 00:29:57 robertj
190 * Moved error stream to common.
192 * Revision 1.32 1998/09/24 04:12:22 robertj
193 * Added open software license.
195 * Revision 1.31 1998/05/30 14:58:56 robertj
196 * Fixed shutdown deadlock (and other failure modes) in cooperative threads.
198 * Revision 1.30 1998/04/17 15:13:08 craigs
199 * Added lazy writes to Config cache
201 * Revision 1.29 1998/03/29 10:42:16 craigs
202 * Changed for new initialisation scheme
204 * Revision 1.28 1998/03/26 05:01:12 robertj
205 * Added PMutex and PSyncPoint classes.
207 * Revision 1.27 1998/01/04 08:09:23 craigs
208 * Added support for PThreads through use of reentrant system calls
210 * Revision 1.26 1998/01/03 22:46:44 craigs
211 * Added PThread support
213 * Revision 1.25 1997/05/10 08:04:15 craigs
214 * Added new routines for access to PErrorStream
216 * Revision 1.24 1997/04/22 10:57:53 craigs
217 * Removed DLL functions and added call the FreeStack
219 * Revision 1.23 1997/02/23 03:06:00 craigs
220 * Changed for PProcess::Current reference
222 * Revision 1.22 1997/02/14 09:18:36 craigs
223 * Changed for PProcess::Current being a reference rather that a ptr
225 * Revision 1.21 1996/12/30 03:21:46 robertj
226 * Added timer to block on wait for child process.
228 * Revision 1.20 1996/12/29 13:25:02 robertj
229 * Fixed GCC warnings.
231 * Revision 1.19 1996/11/16 11:11:46 craigs
232 * Fixed problem with timeout on blocked IO channels
234 * Revision 1.18 1996/11/03 04:35:58 craigs
235 * Added hack to avoid log timeouts, which shouldn't happen!
237 * Revision 1.17 1996/09/21 05:40:10 craigs
238 * Changed signal hcnalding
240 * Revision 1.16 1996/09/03 11:55:19 craigs
241 * Removed some potential problems with return values from system calls
243 * Revision 1.15 1996/06/29 01:43:11 craigs
244 * Moved AllocateStack to switch.cxx to keep platform dependent routines in one place
246 * Revision 1.14 1996/06/10 12:46:53 craigs
247 * Changed process.h include
249 * Revision 1.13 1996/05/25 06:06:33 craigs
250 * Sun4 fixes and updated for gcc 2.7.2
252 * Revision 1.12 1996/05/09 10:55:59 craigs
255 * Revision 1.11 1996/05/03 13:15:27 craigs
256 * More Sun4 & Solaris fixes
258 * Revision 1.10 1996/05/03 13:11:35 craigs
261 * Revision 1.9 1996/05/02 12:11:54 craigs
264 * Revision 1.8 1996/04/18 11:43:38 craigs
265 * Changed GetHomeDir to use effective UID for uid, and changed to
266 * look at passwd file info *before* $HOME variable
268 * Revision 1.7 1996/04/15 10:49:11 craigs
269 * Last build prior to release of MibMaster v1.0
271 * Revision 1.6 1996/01/26 11:09:42 craigs
272 * Added signal handlers
278 //#define SIGNALS_DEBUG
280 #pragma implementation "args.h"
281 #pragma implementation "pprocess.h"
282 #pragma implementation "thread.h"
283 #pragma implementation "semaphor.h"
284 #pragma implementation "mutex.h"
285 #pragma implementation "critsec.h"
286 #pragma implementation "psync.h"
287 #pragma implementation "syncpoint.h"
288 #pragma implementation "syncthrd.h"
291 #include <ptlib/pprocess.h>
294 #include <sys/times.h>
301 #include <sys/time.h>
306 #include <sys/wait.h>
310 #include <sys/cdefs.h>
311 #include <sys/types.h>
312 #include <sys/mman.h>
315 #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(__BEOS__) || defined(P_IRIX) || defined(P_QNX)
316 #include <sys/utsname.h>
318 #elif defined(P_RTEMS)
320 #include <sys/utsname.h>
328 #define SELECT(p1,p2,p3,p4,p5) select(p1,(int *)(p2),(int *)(p3),(int *)(p4),p5)
330 #define SELECT(p1,p2,p3,p4,p5) select(p1,p2,p3,p4,p5)
334 extern "C" void bzero(void *, int);
335 extern "C" int select(int width
,
339 struct timeval
*timeout
);
346 #include "../common/pglobalstatic.cxx"
349 PString
PProcess::GetOSClass()
352 return PString("Unix");
353 #elif defined P_VXWORKS
354 return PString("VxWorks");
356 return PString("Be Inc.");
360 PString
PProcess::GetOSName()
362 #if defined(HAS_UNAME)
366 return PString(info
.sysname
) & info
.release
;
368 return PString(info
.sysname
);
370 #elif defined(P_VXWORKS)
371 return PString::Empty();
373 #warning No GetOSName specified
374 return PString("Unknown");
378 PString
PProcess::GetOSHardware()
380 #if defined(HAS_UNAME)
383 return PString(info
.machine
);
384 #elif defined(P_VXWORKS)
385 return PString(sysModel());
387 #warning No GetOSHardware specified
388 return PString("unknown");
392 PString
PProcess::GetOSVersion()
394 #if defined(HAS_UNAME)
398 return PString(info
.version
);
400 return PString(info
.release
);
402 #elif defined(P_VXWORKS)
403 return PString(sysBspRev());
405 #warning No GetOSVersion specified
406 return PString("?.?");
410 PDirectory
PProcess::GetOSConfigDir()
419 PDirectory
PProcess::PXGetHomeDir ()
427 struct passwd
*pw
= NULL
;
429 #if defined(P_PTHREADS) && !defined(P_THREAD_SAFE_CLIB)
432 #if defined (P_LINUX) || defined(P_AIX) || defined(P_IRIX) || (__GNUC__>=3 && defined(P_SOLARIS)) || defined(P_RTEMS)
433 ::getpwuid_r(geteuid(), &pwd
,
437 pw
= ::getpwuid_r(geteuid(), &pwd
, buffer
, 1024);
440 pw
= ::getpwuid(geteuid());
443 if (pw
!= NULL
&& pw
->pw_dir
!= NULL
)
445 else if ((ptr
= getenv ("HOME")) != NULL
)
450 if (dest
.GetLength() > 0 && dest
[dest
.GetLength()-1] != '/')
457 ///////////////////////////////////////////////////////////////////////////////
461 // Return the effective user name of the process, eg "root" etc.
463 PString
PProcess::GetUserName() const
470 STATUS gethostresult
;
471 gethostresult
=::gethostname(pnamebuf
,len
);
472 if (gethostresult
== OK
)
473 return PString(pnamebuf
,len
);
475 return PString("VxWorks");
479 #if defined(P_PTHREADS) && !defined(P_THREAD_SAFE_CLIB)
482 struct passwd
* pw
= NULL
;
483 #if defined (P_LINUX) || defined (P_AIX) || defined(P_IRIX) || (__GNUC__>=3 && defined(P_SOLARIS)) || defined(P_RTEMS)
484 ::getpwuid_r(geteuid(), &pwd
, buffer
, 1024, &pw
);
486 pw
= ::getpwuid_r(geteuid(), &pwd
, buffer
, 1024);
489 struct passwd
* pw
= ::getpwuid(geteuid());
493 if (pw
!= NULL
&& pw
->pw_name
!= NULL
)
494 return PString(pw
->pw_name
);
495 else if ((ptr
= getenv("USER")) != NULL
)
498 return PString("user");
503 BOOL
PProcess::SetUserName(const PString
& username
, BOOL permanent
)
506 PAssertAlways("PProcess::SetUserName - not implemented for VxWorks");
509 if (username
.IsEmpty())
510 return seteuid(getuid()) != -1;
514 if (username
[0] == '#') {
515 PString s
= username
.Mid(1);
516 if (s
.FindSpan("1234567890") == P_MAX_INDEX
)
520 #if defined(P_PTHREADS) && !defined(P_THREAD_SAFE_CLIB)
523 struct passwd
* pw
= NULL
;
524 #if defined (P_LINUX) || defined (P_AIX) || defined(P_IRIX) || (__GNUC__>=3 && defined(P_SOLARIS)) || defined(P_RTEMS)
525 ::getpwnam_r(username
, &pwd
, buffer
, 1024, &pw
);
527 pw
= ::getpwnam_r(username
, &pwd
, buffer
, 1024);
530 struct passwd
* pw
= ::getpwnam(username
);
533 if (pw
!= NULL
&& pw
->pw_name
!= NULL
)
536 if (username
.FindSpan("1234567890") == P_MAX_INDEX
)
537 uid
= username
.AsInteger();
545 return setuid(uid
) != -1;
547 return seteuid(uid
) != -1;
552 ///////////////////////////////////////////////////////////////////////////////
556 // Return the effective group name of the process, eg "wheel" etc.
558 PString
PProcess::GetGroupName() const
563 return PString("VxWorks");
567 #if defined(P_PTHREADS) && !defined(P_THREAD_SAFE_CLIB)
570 struct group
* gr
= NULL
;
571 #if defined (P_LINUX) || defined (P_AIX) || defined(P_IRIX) || (__GNUC__>=3 && defined(P_SOLARIS)) || defined(P_RTEMS)
572 ::getgrgid_r(getegid(), &grp
, buffer
, 1024, &gr
);
574 gr
= ::getgrgid_r(getegid(), &grp
, buffer
, 1024);
577 struct group
* gr
= ::getgrgid(getegid());
581 if (gr
!= NULL
&& gr
->gr_name
!= NULL
)
582 return PString(gr
->gr_name
);
583 else if ((ptr
= getenv("GROUP")) != NULL
)
586 return PString("group");
591 BOOL
PProcess::SetGroupName(const PString
& groupname
, BOOL permanent
)
594 PAssertAlways("PProcess::SetGroupName - not implemented for VxWorks");
597 if (groupname
.IsEmpty())
598 return setegid(getgid()) != -1;
602 if (groupname
[0] == '#') {
603 PString s
= groupname
.Mid(1);
604 if (s
.FindSpan("1234567890") == P_MAX_INDEX
)
608 #if defined(P_PTHREADS) && !defined(P_THREAD_SAFE_CLIB)
611 struct group
* gr
= NULL
;
612 #if defined (P_LINUX) || defined (P_AIX) || defined(P_IRIX) || (__GNUC__>=3 && defined(P_SOLARIS)) || defined(P_RTEMS)
613 ::getgrnam_r(groupname
, &grp
, buffer
, 1024, &gr
);
615 gr
= ::getgrnam_r(groupname
, &grp
, buffer
, 1024);
618 struct group
* gr
= ::getgrnam(groupname
);
621 if (gr
!= NULL
&& gr
->gr_name
!= NULL
)
624 if (groupname
.FindSpan("1234567890") == P_MAX_INDEX
)
625 gid
= groupname
.AsInteger();
633 return setgid(gid
) != -1;
635 return setegid(gid
) != -1;
639 extern PProcess
* PProcessInstance
;;
641 PString
PX_GetThreadName(pthread_t id
)
643 if (PProcessInstance
!= NULL
) {
644 PWaitAndSignal
m(PProcessInstance
->threadMutex
);
645 PThread
& thread
= PProcessInstance
->activeThreads
[(unsigned)id
];
646 return thread
.GetThreadName();
648 return psprintf("%08x", id
);
651 void PProcess::PXShowSystemWarning(PINDEX num
)
653 PXShowSystemWarning(num
, "");
656 void PProcess::PXShowSystemWarning(PINDEX num
, const PString
& str
)
658 PProcess::Current()._PXShowSystemWarning(num
, str
);
661 void PProcess::_PXShowSystemWarning(PINDEX code
, const PString
& str
)
663 PError
<< "PWLib " << GetOSClass() << " error #" << code
<< '-' << str
<< endl
;
666 void PXSignalHandler(int sig
)
669 fprintf(stderr
,"\nSIGNAL<%u>\n",sig
);
672 PProcess
& process
= PProcess::Current();
673 process
.pxSignals
|= 1 << sig
;
674 process
.PXOnAsyncSignal(sig
);
675 #if defined(P_MAC_MPTHREADS)
676 process
.SignalTimerChange();
677 #elif defined(P_PTHREADS)
678 // Inform house keeping thread we have a signal to be processed
679 process
.SignalTimerChange();
681 signal(sig
, PXSignalHandler
);
684 void PProcess::PXCheckSignals()
690 fprintf(stderr
,"\nCHKSIG<%x>\n",pxSignals
);
693 for (int sig
= 0; sig
< 32; sig
++) {
695 if ((pxSignals
&bit
) != 0) {
703 void SetSignals(void (*handler
)(int))
706 fprintf(stderr
,"\nSETSIG<%x>\n",(INT
)handler
);
713 signal(SIGHUP
, handler
);
716 signal(SIGINT
, handler
);
719 signal(SIGUSR1
, handler
);
722 signal(SIGUSR2
, handler
);
725 signal(SIGPIPE
, handler
);
728 signal(SIGTERM
, handler
);
731 signal(SIGWINCH
, handler
);
734 signal(SIGPROF
, handler
);
739 void PProcess::PXOnAsyncSignal(int sig
)
742 fprintf(stderr
,"\nASYNCSIG<%u>\n",sig
);
756 void PProcess::PXOnSignal(int sig
)
759 fprintf(stderr
,"\nSYNCSIG<%u>\n",sig
);
763 BOOL oldIgnore
= PMemoryHeap::SetIgnoreAllocations(TRUE
);
764 static DWORD allocationIndex
= 0;
769 strm
<< "===============\n";
770 strm
<< activeThreads
.GetSize() << " active threads\n";
771 for (i
= 0; i
< activeThreads
.GetSize(); ++i
) {
772 POrdinalKey key
= activeThreads
.GetKeyAt(i
);
773 PThread
& thread
= activeThreads
[key
];
774 strm
<< " " << thread
<< "\n";
777 strm
<< "---------------\n";
778 PMemoryHeap::DumpObjectsSince(allocationIndex
, strm
);
779 allocationIndex
= PMemoryHeap::GetAllocationRequest();
781 strm
<< "===============\n";
782 threadMutex
.Signal();
783 fprintf(stderr
, "%s", strm
.GetPointer());
785 PMemoryHeap::SetIgnoreAllocations(oldIgnore
);
790 void PProcess::CommonConstruct()
792 // Setup signal handlers
795 SetSignals(&PXSignalHandler
);
797 #if !defined(P_VXWORKS) && !defined(P_RTEMS)
798 // initialise the timezone information
803 CreateConfigFilesDictionary();
807 void PProcess::CommonDestruct()
820 #include <netinet/in.h>
821 #include <rtems/rtems_bsdnet.h>
824 int socketpair(int d
, int type
, int protocol
, int sv
[2])
826 static int port_count
= IPPORT_USERRESERVED
;
829 struct sockaddr_in addr1
, addr2
;
830 static int network_status
= 1;
833 if (network_status
>0)
835 printf("\"Network\" initializing!\n");
836 network_status
= rtems_bsdnet_initialize_network();
837 if (network_status
== 0)
838 printf("\"Network\" initialized!\n");
841 printf("Error: %s\n", strerror(errno
));
850 s
= socket( d
, type
, protocol
);
854 memset(&addr1
, 0, sizeof addr1
);
855 addr1
.sin_family
= d
;
856 addr1
.sin_port
= htons(++port_count
);
857 addr1
.sin_addr
.s_addr
= htonl(INADDR_LOOPBACK
);
859 if (bind(s
, (struct sockaddr
*)&addr1
, sizeof addr1
) < 0)
864 if (listen(s
, 2) < 0 )
870 sv
[0] = socket(d
, type
, protocol
);
877 memset(&addr2
, 0, sizeof addr2
);
878 addr2
.sin_family
= d
;
879 addr2
.sin_port
= htons(++port_count
);
880 addr2
.sin_addr
.s_addr
= htonl(INADDR_LOOPBACK
);
882 if (bind(sv
[0], (struct sockaddr
*)&addr2
, sizeof addr2
) < 0)
889 if (connect(sv
[0], (struct sockaddr
*)&addr1
, sizeof addr1
) < 0)
897 sv
[1] = accept(s
, (struct sockaddr
*)&addr2
, &addrlen
);
913 extern int rtems_bsdnet_loopattach(rtems_bsdnet_ifconfig
*);
914 static struct rtems_bsdnet_ifconfig loopback_config
= {
916 rtems_bsdnet_loopattach
, /* attach function */
918 NULL
, /* link to next interface */
920 "127.0.0.1", /* IP address */
921 "255.0.0.0", /* IP net mask */
925 #warning Change lines below to match Your system settings
928 * Default network interface
930 static struct rtems_bsdnet_ifconfig netdriver_config
= {
931 RTEMS_BSP_NETWORK_DRIVER_NAME
, /* name */
932 RTEMS_BSP_NETWORK_DRIVER_ATTACH
, /* attach function */
934 &loopback_config
, /* link to next interface */
936 "10.0.0.2", /* IP address */
937 "255.255.255.0", /* IP net mask */
939 NULL
, /* Driver supplies hardware address */
940 0 /* Use default driver parameters */
944 * Network configuration
946 struct rtems_bsdnet_config rtems_bsdnet_config
= {
949 NULL
, /* no bootp function */
951 1, /* Default network task priority */
952 0, /* Default mbuf capacity */
953 0, /* Default mbuf cluster capacity */
955 "computer.name", /* Host name */
956 "domain.name", /* Domain name */
957 "10.0.0.1", /* Gateway */
958 "10.0.0.1", /* Log host */
959 {"10.0.0.1" }, /* Name server(s) */
960 {"10.0.0.1" }, /* NTP server(s) */
964 #define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
965 #define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
966 #define CONFIGURE_TEST_NEEDS_TIMER_DRIVER
968 #define CONFIGURE_MICROSECONDS_PER_TICK 1000
969 #define CONFIGURE_TICKS_PER_TIMESLICE 50
971 #define CONFIGURE_MAXIMUM_TASKS rtems_resource_unlimited(50)
972 #define CONFIGURE_MAXIMUM_TIMERS rtems_resource_unlimited(50)
973 #define CONFIGURE_MAXIMUM_SEMAPHORES rtems_resource_unlimited(50)
974 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES rtems_resource_unlimited(50)
975 #define CONFIGURE_MAXIMUM_MUTEXES rtems_resource_unlimited(50)
977 #define CONFIGURE_MAXIMUM_POSIX_THREADS 500
978 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES 500
979 #define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES 500
980 #define CONFIGURE_MAXIMUM_POSIX_KEYS 500
981 #define CONFIGURE_MAXIMUM_POSIX_TIMERS 500
982 #define CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS 500
983 #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES 500
984 #define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES 500
986 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 500
987 #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
989 #define CONFIGURE_POSIX_INIT_THREAD_TABLE
990 #define CONFIGURE_INIT_TASK_INITIAL_MODES (RTEMS_PREEMPT | RTEMS_TIMESLICE)
993 #define STACK_CHECKER_ON
996 void* POSIX_Init(void*);
997 #define CONFIGURE_INIT
998 #include <confdefs.h>
1004 //////////////////////////////////////////////////////////////////
1006 // Non-PTHREAD based routines
1009 #if defined(P_MAC_MPTHREADS)
1010 #include "tlibmpthrd.cxx"
1011 #elif defined(P_PTHREADS)
1012 #include "tlibthrd.cxx"
1013 #elif defined(BE_THREADS)
1014 #include "tlibbe.cxx"
1015 #elif defined(VX_TASKS)
1016 #include "tlibvx.cxx"