thr_exit.c (71771) | thr_exit.c (72374) |
---|---|
1/* 2 * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 15 unchanged lines hidden (view full) --- 24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 * | 1/* 2 * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 15 unchanged lines hidden (view full) --- 24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 * |
32 * $FreeBSD: head/lib/libkse/thread/thr_exit.c 71771 2001-01-29 03:24:23Z deischen $ | 32 * $FreeBSD: head/lib/libkse/thread/thr_exit.c 72374 2001-02-11 22:07:32Z deischen $ |
33 */ 34#include <errno.h> 35#include <unistd.h> 36#include <fcntl.h> 37#include <stdio.h> 38#include <stdlib.h> 39#include <string.h> 40#include <pthread.h> --- 41 unchanged lines hidden (view full) --- 82} 83 84void 85_thread_exit(char *fname, int lineno, char *string) 86{ 87 char s[256]; 88 89 /* Prepare an error message string: */ | 33 */ 34#include <errno.h> 35#include <unistd.h> 36#include <fcntl.h> 37#include <stdio.h> 38#include <stdlib.h> 39#include <string.h> 40#include <pthread.h> --- 41 unchanged lines hidden (view full) --- 82} 83 84void 85_thread_exit(char *fname, int lineno, char *string) 86{ 87 char s[256]; 88 89 /* Prepare an error message string: */ |
90 strcpy(s, "Fatal error '"); 91 strcat(s, string); 92 strcat(s, "' at line ? "); 93 strcat(s, "in file "); 94 strcat(s, fname); 95 strcat(s, " (errno = ?"); 96 strcat(s, ")\n"); | 90 snprintf(s, sizeof(s), 91 "Fatal error '%s' at line %d in file %s (errno = %d)\n", 92 string, lineno, fname, errno); |
97 98 /* Write the string to the standard error file descriptor: */ 99 __sys_write(2, s, strlen(s)); 100 101 /* Force this process to exit: */ 102 /* XXX - Do we want abort to be conditional on _PTHREADS_INVARIANTS? */ 103#if defined(_PTHREADS_INVARIANTS) 104 abort(); --- 17 unchanged lines hidden (view full) --- 122 * not release any visible resources (such as mutexes) and that 123 * it is the applications responsibility. Resources that are 124 * internal to the threads library, including file and fd locks, 125 * are not visible to the application and need to be released. 126 */ 127 /* Unlock all owned fd locks: */ 128 _thread_fd_unlock_owned(curthread); 129 | 93 94 /* Write the string to the standard error file descriptor: */ 95 __sys_write(2, s, strlen(s)); 96 97 /* Force this process to exit: */ 98 /* XXX - Do we want abort to be conditional on _PTHREADS_INVARIANTS? */ 99#if defined(_PTHREADS_INVARIANTS) 100 abort(); --- 17 unchanged lines hidden (view full) --- 118 * not release any visible resources (such as mutexes) and that 119 * it is the applications responsibility. Resources that are 120 * internal to the threads library, including file and fd locks, 121 * are not visible to the application and need to be released. 122 */ 123 /* Unlock all owned fd locks: */ 124 _thread_fd_unlock_owned(curthread); 125 |
130 /* Unlock all owned file locks: */ 131 _funlock_owned(curthread); 132 | |
133 /* Unlock all private mutexes: */ 134 _mutex_unlock_private(curthread); 135 136 /* 137 * This still isn't quite correct because we don't account 138 * for held spinlocks (see libc/stdlib/malloc.c). 139 */ 140} --- 98 unchanged lines hidden --- | 126 /* Unlock all private mutexes: */ 127 _mutex_unlock_private(curthread); 128 129 /* 130 * This still isn't quite correct because we don't account 131 * for held spinlocks (see libc/stdlib/malloc.c). 132 */ 133} --- 98 unchanged lines hidden --- |