diff options
Diffstat (limited to 'cpukit')
-rw-r--r-- | cpukit/libnetworking/ChangeLog | 12 | ||||
-rw-r--r-- | cpukit/libnetworking/Makefile.am | 3 | ||||
-rw-r--r-- | cpukit/libnetworking/rtems/rtems_bsdnet.h | 7 | ||||
-rw-r--r-- | cpukit/libnetworking/rtems/rtems_bsdnet_malloc_starvation.c | 15 | ||||
-rw-r--r-- | cpukit/libnetworking/rtems/rtems_glue.c | 8 |
5 files changed, 40 insertions, 5 deletions
diff --git a/cpukit/libnetworking/ChangeLog b/cpukit/libnetworking/ChangeLog index 79bae776c3..8415ce70a1 100644 --- a/cpukit/libnetworking/ChangeLog +++ b/cpukit/libnetworking/ChangeLog @@ -1,3 +1,15 @@ +2002-03-25 Eric Norum <norume@aps.anl.gov> + + + PR 374/networking + * Makefile.am, rtems/rtems_bsdnet.h, rtems/rtems_glue.c: + The patch sent as part of PR270 got applied to the wrong place. + The effect was that (1) startup was no faster than before and + (2) malloc starvation messages came way too quickly. The attached + patch fixes both these problems and also provides a mechanism for + applications to handle malloc starvation conditions as they see fit. + * rtems/rtems_bsdnet_malloc_starvation.c: New file. + 2003-03-18 Till Straumann <strauman@slac.stanford.edu> PR 356/bsps diff --git a/cpukit/libnetworking/Makefile.am b/cpukit/libnetworking/Makefile.am index 793e0c1759..1fb550e079 100644 --- a/cpukit/libnetworking/Makefile.am +++ b/cpukit/libnetworking/Makefile.am @@ -159,7 +159,8 @@ PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems \ rtems_C_FILES = rtems/sghostname.c rtems/issetugid.c rtems/rtems_glue.c rtems/rtems_syscall.c \ rtems/rtems_bootp.c rtems/rtems_showmbuf.c rtems/rtems_showroute.c rtems/rtems_showifstat.c \ rtems/rtems_showipstat.c rtems/rtems_showicmpstat.c rtems/rtems_showtcpstat.c \ - rtems/rtems_showudpstat.c rtems/rtems_select.c rtems/mkrootfs.c + rtems/rtems_showudpstat.c rtems/rtems_select.c rtems/mkrootfs.c \ + rtems/rtems_bsdnet_malloc_starvation.c OBJS += $(rtems_C_FILES:rtems/%.c=$(ARCH)/%.$(OBJEXT)) $(ARCH)/%.$(OBJEXT): rtems/%.c diff --git a/cpukit/libnetworking/rtems/rtems_bsdnet.h b/cpukit/libnetworking/rtems/rtems_bsdnet.h index e9c8f3965a..72464ddec7 100644 --- a/cpukit/libnetworking/rtems/rtems_bsdnet.h +++ b/cpukit/libnetworking/rtems/rtems_bsdnet.h @@ -182,4 +182,11 @@ void rtems_bsdnet_do_bootp_and_rootfs (void); int rtems_bsdnet_synchronize_ntp (int interval, rtems_task_priority priority); +/* + * Callback to report BSD malloc starvation. + * The default implementation just prints a message but an application + * can provide its own version. + */ +void rtems_bsdnet_malloc_starvation(void); + #endif /* _RTEMS_BSDNET_ */ diff --git a/cpukit/libnetworking/rtems/rtems_bsdnet_malloc_starvation.c b/cpukit/libnetworking/rtems/rtems_bsdnet_malloc_starvation.c new file mode 100644 index 0000000000..20af7a97b8 --- /dev/null +++ b/cpukit/libnetworking/rtems/rtems_bsdnet_malloc_starvation.c @@ -0,0 +1,15 @@ +/* + * Routine called when malloc() is not succeeding. This can be overridden + * by a BSP. + * + * $Id* + */ + +#include <stdio.h> +#include <rtems_bsdnet.h> + +void +rtems_bsdnet_malloc_starvation(void) +{ + printf ("rtems_bsdnet_malloc still waiting.\n"); +} diff --git a/cpukit/libnetworking/rtems/rtems_glue.c b/cpukit/libnetworking/rtems/rtems_glue.c index 4ed1455cff..d1aad32023 100644 --- a/cpukit/libnetworking/rtems/rtems_glue.c +++ b/cpukit/libnetworking/rtems/rtems_glue.c @@ -117,11 +117,10 @@ rtems_bsdnet_malloc (unsigned long size, int type, int flags) return p; rtems_bsdnet_semaphore_release (); if (++try >= 30) { - printf ("rtems_bsdnet_malloc still waiting.\n"); + rtems_bsdnet_malloc_starvation(); try = 0; } - while (rtems_bsdnet_seconds_since_boot() == 0) - rtems_task_wake_after(1); + rtems_task_wake_after (rtems_bsdnet_ticks_per_second); rtems_bsdnet_semaphore_obtain (); } } @@ -272,7 +271,8 @@ rtems_bsdnet_initialize (void) /* * Ensure that `seconds' is greater than 0 */ - rtems_task_wake_after (rtems_bsdnet_ticks_per_second); + while (rtems_bsdnet_seconds_since_boot() == 0) + rtems_task_wake_after(1); /* * Set up BSD-style sockets |