6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 #include "lint.h"
28 #include "thr_uberdata.h"
29
30 const char *panicstr;
31 ulwp_t *panic_thread;
32
33 static mutex_t assert_lock = DEFAULTMUTEX;
34 static ulwp_t *assert_thread = NULL;
35
36 /*
37 * Called from __assert() to set panicstr and panic_thread.
38 */
39 void
40 __set_panicstr(const char *msg)
41 {
42 panicstr = msg;
43 panic_thread = __curthread();
44 }
45
424 * assert_thread = NULL;
425 * _lwp_mutex_unlock(&assert_lock);
426 * if (self != NULL)
427 * exit_critical(self);
428 */
429 Abort(buf);
430 }
431
432 /*
433 * We define and export this version of assfail() just because libaio
434 * used to define and export it, needlessly. Now that libaio is folded
435 * into libc, we need to continue this for ABI/version reasons.
436 * We don't use "#pragma weak assfail __assfail" in order to avoid
437 * warnings from the check_fnames utility at build time for libraries
438 * that define their own version of assfail().
439 */
440 void
441 assfail(const char *assertion, const char *filename, int line_num)
442 {
443 __assfail(assertion, filename, line_num);
444 }
|
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26 /*
27 * Copyright (c) 2012 by Delphix. All rights reserved.
28 */
29
30 #include "lint.h"
31 #include "thr_uberdata.h"
32
33 const char *panicstr;
34 ulwp_t *panic_thread;
35
36 static mutex_t assert_lock = DEFAULTMUTEX;
37 static ulwp_t *assert_thread = NULL;
38
39 /*
40 * Called from __assert() to set panicstr and panic_thread.
41 */
42 void
43 __set_panicstr(const char *msg)
44 {
45 panicstr = msg;
46 panic_thread = __curthread();
47 }
48
427 * assert_thread = NULL;
428 * _lwp_mutex_unlock(&assert_lock);
429 * if (self != NULL)
430 * exit_critical(self);
431 */
432 Abort(buf);
433 }
434
435 /*
436 * We define and export this version of assfail() just because libaio
437 * used to define and export it, needlessly. Now that libaio is folded
438 * into libc, we need to continue this for ABI/version reasons.
439 * We don't use "#pragma weak assfail __assfail" in order to avoid
440 * warnings from the check_fnames utility at build time for libraries
441 * that define their own version of assfail().
442 */
443 void
444 assfail(const char *assertion, const char *filename, int line_num)
445 {
446 __assfail(assertion, filename, line_num);
447 }
448
449 void
450 assfail3(const char *assertion, uintmax_t lv, const char *op, uintmax_t rv,
451 const char *filename, int line_num)
452 {
453 char buf[1000];
454 (void) strcpy(buf, assertion);
455 (void) strcat(buf, " (0x");
456 ultos((uint64_t)lv, 16, buf + strlen(buf));
457 (void) strcat(buf, " ");
458 (void) strcat(buf, op);
459 (void) strcat(buf, " 0x");
460 ultos((uint64_t)rv, 16, buf + strlen(buf));
461 (void) strcat(buf, ")");
462 __assfail(buf, filename, line_num);
463 }
|