Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(427)

Side by Side Diff: sysdeps/unix/sysv/linux/libc_fatal.c

Issue 7785030: Replace #define syscalls cancel machinery. (Closed) Base URL: http://git.chromium.org/native_client/nacl-glibc.git@master
Patch Set: Cosmetic change Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sysdeps/unix/sysv/linux/futimes.c ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Copyright (C) 1993-1995,1997,2000,2002-2005 Free Software Foundation, Inc. 1 /* Copyright (C) 1993-1995,1997,2000,2002-2005 Free Software Foundation, Inc.
2 This file is part of the GNU C Library. 2 This file is part of the GNU C Library.
3 3
4 The GNU C Library is free software; you can redistribute it and/or 4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public 5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either 6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version. 7 version 2.1 of the License, or (at your option) any later version.
8 8
9 The GNU C Library is distributed in the hope that it will be useful, 9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 18 matching lines...) Expand all
29 #include <sys/syslog.h> 29 #include <sys/syslog.h>
30 #include <execinfo.h> 30 #include <execinfo.h>
31 31
32 /* Abort with an error message. */ 32 /* Abort with an error message. */
33 #include <not-cancel.h> 33 #include <not-cancel.h>
34 34
35 #ifdef FATAL_PREPARE_INCLUDE 35 #ifdef FATAL_PREPARE_INCLUDE
36 #include FATAL_PREPARE_INCLUDE 36 #include FATAL_PREPARE_INCLUDE
37 #endif 37 #endif
38 38
39 struct str_list 39 struct __str_list
40 { 40 {
41 const char *str; 41 const char *str;
42 size_t len; 42 size_t len;
43 struct str_list *next; 43 struct __str_list *next;
44 }; 44 };
45 45
46 46
47 /* Abort with an error message. */ 47 /* Abort with an error message. */
48 void 48 void
49 __libc_message (int do_abort, const char *fmt, ...) 49 __libc_message (int do_abort, const char *fmt, ...)
50 { 50 {
51 va_list ap; 51 va_list ap;
52 va_list ap_copy; 52 va_list ap_copy;
53 int fd = -1; 53 int fd = -1;
54 54
55 va_start (ap, fmt); 55 va_start (ap, fmt);
56 va_copy (ap_copy, ap); 56 va_copy (ap_copy, ap);
57 57
58 #ifdef FATAL_PREPARE 58 #ifdef FATAL_PREPARE
59 FATAL_PREPARE; 59 FATAL_PREPARE;
60 #endif 60 #endif
61 61
62 /* Open a descriptor for /dev/tty unless the user explicitly 62 /* Open a descriptor for /dev/tty unless the user explicitly
63 requests errors on standard error. */ 63 requests errors on standard error. */
64 const char *on_2 = __secure_getenv ("LIBC_FATAL_STDERR_"); 64 const char *on_2 = __secure_getenv ("LIBC_FATAL_STDERR_");
65 if (on_2 == NULL || *on_2 == '\0') 65 if (on_2 == NULL || *on_2 == '\0')
66 fd = open_not_cancel_2 (_PATH_TTY, O_RDWR | O_NOCTTY | O_NDELAY); 66 fd = open_not_cancel_2 (_PATH_TTY, O_RDWR | O_NOCTTY | O_NDELAY);
67 67
68 if (fd == -1) 68 if (fd == -1)
69 fd = STDERR_FILENO; 69 fd = STDERR_FILENO;
70 70
71 struct str_list *list = NULL; 71 struct __str_list *list = NULL;
72 int nlist = 0; 72 int nlist = 0;
73 73
74 const char *cp = fmt; 74 const char *cp = fmt;
75 while (*cp != '\0') 75 while (*cp != '\0')
76 { 76 {
77 /* Find the next "%s" or the end of the string. */ 77 /* Find the next "%s" or the end of the string. */
78 const char *next = cp; 78 const char *next = cp;
79 while (next[0] != '%' || next[1] != 's') 79 while (next[0] != '%' || next[1] != 's')
80 { 80 {
81 next = __strchrnul (next + 1, '%'); 81 next = __strchrnul (next + 1, '%');
(...skipping 11 matching lines...) Expand all
93 len = strlen (str); 93 len = strlen (str);
94 cp += 2; 94 cp += 2;
95 } 95 }
96 else 96 else
97 { 97 {
98 str = cp; 98 str = cp;
99 len = next - cp; 99 len = next - cp;
100 cp = next; 100 cp = next;
101 } 101 }
102 102
103 struct str_list *newp = alloca (sizeof (struct str_list)); 103 struct __str_list *newp = alloca (sizeof (struct __str_list));
104 newp->str = str; 104 newp->str = str;
105 newp->len = len; 105 newp->len = len;
106 newp->next = list; 106 newp->next = list;
107 list = newp; 107 list = newp;
108 ++nlist; 108 ++nlist;
109 } 109 }
110 110
111 bool written = false; 111 bool written = false;
112 if (nlist > 0) 112 if (nlist > 0)
113 { 113 {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 174
175 void 175 void
176 __libc_fatal (message) 176 __libc_fatal (message)
177 const char *message; 177 const char *message;
178 { 178 {
179 /* The loop is added only to keep gcc happy. */ 179 /* The loop is added only to keep gcc happy. */
180 while (1) 180 while (1)
181 __libc_message (1, "%s", message); 181 __libc_message (1, "%s", message);
182 } 182 }
183 libc_hidden_def (__libc_fatal) 183 libc_hidden_def (__libc_fatal)
OLDNEW
« no previous file with comments | « sysdeps/unix/sysv/linux/futimes.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698