xref: /titanic_44/usr/src/cmd/sgs/prof/common/symintErr.c (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 /*	Copyright (c) 1988 AT&T	*/
27 /*	  All Rights Reserved  	*/
28 
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include "symint.h"
33 
34 #include <stdio.h>
35 #include <stdarg.h>
36 
37 /* * * * * *
38  * symintFcns.c -- symbol information interface routines.
39  *
40  * these routines form a symbol information access
41  * interface, for the profilers to get at object file
42  * information.  this interface was designed to aid
43  * in the COFF to ELF conversion of prof, lprof and friends.
44  *
45  */
46 
47 
48 /* * * * * *
49  * _err_exit(format_s, va_alist)
50  * format_s	- printf(3S) arg string.
51  * va_alist	- var_args(3?) printf() arguments.
52  *
53  * does not return - prints message and calls exit(3).
54  *
55  *
56  * this routine spits out a message (passed as above)
57  * and exits.
58  */
59 
60 _err_exit(char *format_s, ...)
61 {
62 	va_list ap;
63 
64 	fprintf(stderr, "fatal error: ");
65 	va_start(ap, format_s);
66 	vfprintf(stderr, format_s, ap);
67 	va_end(ap);
68 	fprintf(stderr, "\n");
69 
70 debugp1("--- this is where we exit ---\n")
71 
72 	exit(1);
73 }
74 
75 
76 /* * * * * *
77  * _err_warn(format_s, va_alist)
78  * format_s	- printf(3S) arg string.
79  * va_alist	- var_args(3?) printf() arguments.
80  *
81  *
82  * This routine prints a warning (passed as above)
83  */
84 
85 _err_warn(char *format_s, ...)
86 {
87 	va_list ap;
88 
89 	fprintf(stderr, "Warning: ");
90 	va_start(ap, format_s);
91 	vfprintf(stderr, format_s, ap);
92 	va_end(ap);
93 	fprintf(stderr, "\n");
94 }
95