Changeset 20235a3 in mainline for uspace/app/klog/klog.c
- Timestamp:
- 2010-09-02T20:55:28Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0c39b96
- Parents:
- 0c61955 (diff), 3249673 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/klog/klog.c
r0c61955 r20235a3 43 43 #include <event.h> 44 44 #include <errno.h> 45 #include <str_error.h> 45 46 #include <io/klog.h> 46 47 47 #define NAME "klog" 48 #define NAME "klog" 49 #define LOG_FNAME "/log/klog" 48 50 49 51 /* Pointer to klog area */ 50 52 static wchar_t *klog; 51 53 static size_t klog_length; 54 55 static FILE *log; 52 56 53 57 static void interrupt_received(ipc_callid_t callid, ipc_call_t *call) … … 58 62 size_t i; 59 63 60 for (i = klog_len - klog_stored; i < klog_len; i++) 61 putchar(klog[(klog_start + i) % klog_length]); 64 for (i = klog_len - klog_stored; i < klog_len; i++) { 65 wchar_t ch = klog[(klog_start + i) % klog_length]; 66 67 putchar(ch); 68 69 if (log != NULL) 70 fputc(ch, log); 71 } 72 73 if (log != NULL) { 74 fflush(log); 75 fsync(fileno(log)); 76 } 62 77 } 63 78 … … 91 106 } 92 107 108 /* 109 * Mode "a" would be definitively much better here, but it is 110 * not well supported by the FAT driver. 111 * 112 */ 113 log = fopen(LOG_FNAME, "w"); 114 if (log == NULL) 115 printf("%s: Unable to create log file %s (%s)\n", NAME, LOG_FNAME, 116 str_error(errno)); 117 93 118 async_set_interrupt_received(interrupt_received); 94 119 klog_update();
Note:
See TracChangeset
for help on using the changeset viewer.