OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-newlib/] [newlib-1.17.0/] [newlib/] [libc/] [stdlib/] [abort.c] - Blame information for rev 9

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 9 jlechner
/* NetWare can not use this implementation of abort.  It provides its
2
   own version of abort in clib.nlm.  If we can not use clib.nlm, then
3
   we must write abort in sys/netware.  */
4
 
5
#ifdef ABORT_PROVIDED
6
 
7
int _dummy_abort = 1;
8
 
9
#else
10
 
11
/*
12
FUNCTION
13
<<abort>>---abnormal termination of a program
14
 
15
INDEX
16
        abort
17
 
18
ANSI_SYNOPSIS
19
        #include <stdlib.h>
20
        void abort(void);
21
 
22
TRAD_SYNOPSIS
23
        #include <stdlib.h>
24
        void abort();
25
 
26
DESCRIPTION
27
Use <<abort>> to signal that your program has detected a condition it
28
cannot deal with.  Normally, <<abort>> ends your program's execution.
29
 
30
Before terminating your program, <<abort>> raises the exception <<SIGABRT>>
31
(using `<<raise(SIGABRT)>>').  If you have used <<signal>> to register
32
an exception handler for this condition, that handler has the
33
opportunity to retain control, thereby avoiding program termination.
34
 
35
In this implementation, <<abort>> does not perform any stream- or
36
file-related cleanup (the host environment may do so; if not, you can
37
arrange for your program to do its own cleanup with a <<SIGABRT>>
38
exception handler).
39
 
40
RETURNS
41
<<abort>> does not return to its caller.
42
 
43
PORTABILITY
44
ANSI C requires <<abort>>.
45
 
46
Supporting OS subroutines required: <<_exit>> and optionally, <<write>>.
47
*/
48
 
49
#include <stdlib.h>
50
#include <unistd.h>
51
#include <signal.h>
52
 
53
_VOID
54
_DEFUN_VOID (abort)
55
{
56
#ifdef ABORT_MESSAGE
57
  write (2, "Abort called\n", sizeof ("Abort called\n")-1);
58
#endif
59
 
60
  while (1)
61
    {
62
      raise (SIGABRT);
63
      _exit (1);
64
    }
65
}
66
 
67
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.