diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2011-04-20 23:35:42 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2011-04-20 23:40:16 +0200 |
commit | 67d4e8403fe12592f99cf6fc51e4f33684899d6b (patch) | |
tree | c4f8ed13d12ab04e067d396dd3c39b6afeadeb1a /kern | |
parent | a44f51203c43bb4306a225506075740cdacaccfa (diff) |
Warn once when part of the kernel is lacking memory
* kern/printf.h (printf_once): New macro.
* ipc/mach_port.c (mach_port_names, mach_port_get_set_status): Warn when
returning KERN_RESOURCE_SHORTAGE.
* vm/vm_kern.c: Include printf.h.
(kmem_alloc, kmem_realloc, kmem_alloc_wired, kmem_alloc_aligned,
kmem_alloc_pageable): Warn when failing.
* vm/vm_resident.c (vm_page_grab_contiguous_pages): Warn when returning
KERN_RESOURCE_SHORTAGE.
Diffstat (limited to 'kern')
-rw-r--r-- | kern/printf.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/kern/printf.h b/kern/printf.h index 1383198..c5effe5 100644 --- a/kern/printf.h +++ b/kern/printf.h @@ -43,6 +43,15 @@ extern int sprintf (char *buf, const char *fmt, ...); extern int printf (const char *fmt, ...); +#define printf_once(fmt, ...) \ + MACRO_BEGIN \ + static int __once = 0; \ + if (!__once) { \ + printf(fmt, ##__VA_ARGS__); \ + __once = 1; \ + } \ + MACRO_END + extern int indent; extern void iprintf (const char *fmt, ...); |