Added assert to syslib. Moved panic from sysutil to syslib for assert.
Panic now tries sys_kill with SIGKILL first.
This commit is contained in:
		
							parent
							
								
									c1da6e6e24
								
							
						
					
					
						commit
						36e8c1a185
					
				@ -5,6 +5,8 @@ CFLAGS="-O -D_MINIX -D_POSIX_SOURCE"
 | 
			
		||||
LIBRARIES=libsys
 | 
			
		||||
 | 
			
		||||
libsys_FILES=" \
 | 
			
		||||
	assert.c \
 | 
			
		||||
	panic.c \
 | 
			
		||||
	pci_attr_r16.c \
 | 
			
		||||
	pci_attr_r32.c \
 | 
			
		||||
	pci_attr_r8.c \
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										14
									
								
								lib/syslib/assert.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								lib/syslib/assert.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,14 @@
 | 
			
		||||
/*
 | 
			
		||||
 * assert.c - diagnostics
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include	<assert.h>
 | 
			
		||||
#include	<stdio.h>
 | 
			
		||||
#include	<minix/config.h>
 | 
			
		||||
#include	<minix/const.h>
 | 
			
		||||
#include	<minix/sysutil.h>
 | 
			
		||||
 | 
			
		||||
void __bad_assertion(const char *mess) {
 | 
			
		||||
	printf("%s", mess);
 | 
			
		||||
	panic(NULL, NULL, NO_NUM);
 | 
			
		||||
}
 | 
			
		||||
@ -1,6 +1,8 @@
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <signal.h>
 | 
			
		||||
#include <minix/sysutil.h>
 | 
			
		||||
 | 
			
		||||
#include "sysutil.h"
 | 
			
		||||
#include "syslib.h"
 | 
			
		||||
 | 
			
		||||
int panicing= 0;
 | 
			
		||||
 | 
			
		||||
@ -28,8 +30,8 @@ int num;			/* number to go with format string */
 | 
			
		||||
      }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* Exit nicely through PM. */
 | 
			
		||||
  exit(1);
 | 
			
		||||
  /* Try to signal ourself */
 | 
			
		||||
  sys_kill(SELF, SIGKILL);
 | 
			
		||||
 | 
			
		||||
  /* If exiting nicely through PM fails for some reason, try to
 | 
			
		||||
   * commit suicide. E.g., message to PM might fail due to deadlock.
 | 
			
		||||
@ -15,7 +15,6 @@ libsysutil_FILES=" \
 | 
			
		||||
	env_panic.c \
 | 
			
		||||
	env_prefix.c \
 | 
			
		||||
	fkey_ctl.c \
 | 
			
		||||
	panic.c \
 | 
			
		||||
	report.c \
 | 
			
		||||
	taskcall.c"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user