From eb157872bd6935a76814f4f550a143d4f0ee15de Mon Sep 17 00:00:00 2001 From: "W. Eric Norum" Date: Tue, 3 Dec 2002 22:00:12 +0000 Subject: [PATCH] Use EPICS logging routines. No more syslog. Unless othersise specified, run the network daemons at a lower priority than the EPICS scan threads. This makes the scan response much more deterministic. --- src/RTEMS/base/rtems_init.c | 42 ++++++++++++++++++++------------ src/RTEMS/base/rtems_netconfig.c | 16 ++++++------ 2 files changed, 35 insertions(+), 23 deletions(-) diff --git a/src/RTEMS/base/rtems_init.c b/src/RTEMS/base/rtems_init.c index a9968b7af..c187adb2b 100644 --- a/src/RTEMS/base/rtems_init.c +++ b/src/RTEMS/base/rtems_init.c @@ -17,13 +17,11 @@ #include #include #include -#include #include #include #include #include #include -#include #include #include #include @@ -31,6 +29,7 @@ #include #include +#include #include #include @@ -68,8 +67,7 @@ logReset (void) break; } } - syslog (LOG_NOTICE, "Startup after %s.", cbuf); - printf ("Startup after %s.\n", cbuf); + errlogPrintf ("Startup after %s.\n", cbuf); m360.rsr = ~0; } @@ -78,7 +76,7 @@ logReset (void) static void logReset (void) { - syslog (LOG_NOTICE, "Started."); + errlogPrintf ("Started.\n"); } #endif @@ -128,7 +126,7 @@ LogFatal (const char *msg, ...) va_list ap; va_start (ap, msg); - vsyslog (LOG_ALERT, msg, ap); + errlogVprintf (msg, ap); va_end (ap); delayedPanic (msg); } @@ -139,7 +137,7 @@ LogFatal (const char *msg, ...) void LogRtemsFatal (const char *msg, rtems_status_code sc) { - syslog (LOG_ALERT, "%s: %s", msg, rtems_status_text (sc)); + errlogPrintf ("%s: %s\n", msg, rtems_status_text (sc)); delayedPanic (msg); } @@ -149,7 +147,7 @@ LogRtemsFatal (const char *msg, rtems_status_code sc) void LogNetFatal (const char *msg, int err) { - syslog (LOG_ALERT, "%s: %d", msg, err); + errlogPrintf ("%s: %d\n", msg, err); delayedPanic (msg); } @@ -266,11 +264,7 @@ Init (rtems_task_argument ignored) char arg1[] = "st.cmd"; char *argv[3] = { arg0, arg1, NULL }; rtems_interval ticksPerSecond; - - /* - * Get configuration - */ - rtems_clock_get (RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticksPerSecond); + rtems_task_priority newpri; /* * Architecture-specific hooks @@ -279,6 +273,19 @@ Init (rtems_task_argument ignored) initRemoteGdb(ticksPerSecond); #endif + /* + * Get configuration + */ + rtems_clock_get (RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticksPerSecond); + + /* + * Override RTEMS configuration + */ + rtems_task_set_priority ( + RTEMS_SELF, + epicsThreadGetOssPriorityValue(epicsThreadPriorityIocsh), + &newpri); + /* * Create a reasonable environment */ @@ -290,6 +297,12 @@ Init (rtems_task_argument ignored) /* * Start network */ + if (rtems_bsdnet_config.network_task_priority == 0) { + unsigned int p; + if (epicsThreadHighestPriorityLevelBelow(epicsThreadPriorityScanLow, &p) + == epicsThreadBooleanStatusSuccess) + rtems_bsdnet_config.network_task_priority = epicsThreadGetOssPriorityValue(p); + } printf ("***** Initializing network *****\n"); rtems_bsdnet_initialize_network (); printf ("***** Initializing TFTP *****\n"); @@ -318,9 +331,6 @@ Init (rtems_task_argument ignored) break; } } - printf ("***** Initializing syslog *****\n"); - openlog ("IOC", LOG_CONS, LOG_DAEMON); - logReset (); /* * Run the EPICS startup script diff --git a/src/RTEMS/base/rtems_netconfig.c b/src/RTEMS/base/rtems_netconfig.c index 405bdb80d..7851a9fb0 100644 --- a/src/RTEMS/base/rtems_netconfig.c +++ b/src/RTEMS/base/rtems_netconfig.c @@ -18,8 +18,6 @@ #include #include -#define NETWORK_TASK_PRIORITY 90 - extern void rtems_bsdnet_loopattach(); static struct rtems_bsdnet_ifconfig loopback_config = { "lo0", /* name */ @@ -76,9 +74,13 @@ static struct rtems_bsdnet_ifconfig bsp_driver_config = { #endif struct rtems_bsdnet_config rtems_bsdnet_config = { - FIRST_DRIVER_CONFIG, /* Link to next interface */ - rtems_bsdnet_do_bootp, /* Use BOOTP to get network configuration */ - NETWORK_TASK_PRIORITY, /* Network task priority */ - 180*1024, /* MBUF space */ - 350*1024, /* MBUF cluster space */ + FIRST_DRIVER_CONFIG, /* Link to next interface */ + rtems_bsdnet_do_bootp, /* Use BOOTP to get network configuration */ + 0, /* If 0 then the network daemons will run at a */ + /* priority just less than the lowest-priority */ + /* EPICS scan thread. */ + /* If non-zero then the network daemons will run */ + /* at this *RTEMS* priority */ + 180*1024, /* MBUF space */ + 350*1024, /* MBUF cluster space */ };