Changeset 6fa9a99d in mainline
- Timestamp:
- 2014-01-05T17:50:01Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 91db0280
- Parents:
- 208b5f5
- Files:
-
- 23 edited
- 6 moved
Legend:
- Unmodified
- Added
- Removed
-
.bzrignore
r208b5f5 r6fa9a99d 33 33 uspace/app/kill/kill 34 34 uspace/app/killall/killall 35 uspace/app/k log/klog35 uspace/app/kio/kio 36 36 uspace/app/loc/loc 37 37 uspace/app/logset/logset … … 82 82 uspace/dist/app/kill 83 83 uspace/dist/app/killall 84 uspace/dist/app/k log84 uspace/dist/app/kio 85 85 uspace/dist/app/loc 86 86 uspace/dist/app/logset -
abi/include/abi/ipc/event.h
r208b5f5 r6fa9a99d 38 38 /** Global events */ 39 39 typedef enum event_type { 40 /** New data available in kernel log*/41 EVENT_K LOG= 0,40 /** New data available in kernel character buffer */ 41 EVENT_KIO = 0, 42 42 /** Returning from kernel console to uspace */ 43 43 EVENT_KCONSOLE, -
abi/include/abi/kio.h
r208b5f5 r6fa9a99d 33 33 */ 34 34 35 #ifndef ABI_K LOG_H_36 #define ABI_K LOG_H_35 #ifndef ABI_KIO_H_ 36 #define ABI_KIO_H_ 37 37 38 38 enum { 39 K LOG_UNKNOW,40 K LOG_WRITE,41 K LOG_UPDATE,42 K LOG_COMMAND39 KIO_UNKNOW, 40 KIO_WRITE, 41 KIO_UPDATE, 42 KIO_COMMAND 43 43 }; 44 44 -
abi/include/abi/syscall.h
r208b5f5 r6fa9a99d 37 37 38 38 typedef enum { 39 SYS_K LOG= 0,39 SYS_KIO = 0, 40 40 SYS_TLS_SET = 1, /* Hardcoded for AMD64, IA-32 (fibril.S in uspace) */ 41 41 -
boot/Makefile.common
r208b5f5 r6fa9a99d 161 161 $(USPACE_PATH)/app/bdsh/bdsh \ 162 162 $(USPACE_PATH)/app/getterm/getterm \ 163 $(USPACE_PATH)/app/k log/klog\163 $(USPACE_PATH)/app/kio/kio \ 164 164 $(USPACE_PATH)/app/vlaunch/vlaunch \ 165 165 $(USPACE_PATH)/app/vterm/vterm -
contrib/arch/HelenOS.adl
r208b5f5 r6fa9a99d 22 22 23 23 /* Kernel log */ 24 inst k log klog;24 inst kio kio; 25 25 26 26 [/uspace/lib/libc/bind%ns] … … 30 30 [/uspace/lib/libc/bind%vfs] 31 31 [/uspace/lib/libc/bind%console] 32 [/uspace/lib/libc/bind%k log]32 [/uspace/lib/libc/bind%kio] 33 33 34 34 bind ns:kbd to console:kbd; … … 58 58 bind console:sys_console to kernel:sys_console; 59 59 60 bind k log:ns to ns:ns;60 bind kio:ns to ns:ns; 61 61 }; -
contrib/arch/kernel/kernel.adl
r208b5f5 r6fa9a99d 3 3 *****************************/ 4 4 5 interface sys_k log{5 interface sys_kio { 6 6 /* Print using kernel facility */ 7 sysarg_t sys_k log(int fd, const void *buf, size_t size);8 protocol: 9 ?sys_k log*7 sysarg_t sys_kio(int fd, const void *buf, size_t size); 8 protocol: 9 ?sys_kio* 10 10 }; 11 11 … … 251 251 frame sys_console { 252 252 provides: 253 sys_k log sys_klog;253 sys_kio sys_kio; 254 254 sys_console sys_console; 255 255 }; … … 316 316 inst sys_debug sys_debug; 317 317 318 delegate sys_k log to sys_console:sys_klog;318 delegate sys_kio to sys_console:sys_kio; 319 319 delegate sys_console to sys_console:sys_console; 320 320 delegate sys_tls to sys_proc:sys_tls; -
contrib/arch/uspace/app/kio/kio.adl
r208b5f5 r6fa9a99d 1 frame k log{1 frame kio { 2 2 requires: 3 3 naming_service ns; 4 4 [/uspace/lib/libc/requires] 5 5 initialization: 6 !ns.ipc_m_share_in /* SERVICE_MEM_K LOG*/6 !ns.ipc_m_share_in /* SERVICE_MEM_KIO */ 7 7 protocol: 8 8 [/uspace/lib/libc/protocol] -
contrib/arch/uspace/lib/libc/bind
r208b5f5 r6fa9a99d 1 1 /* Bind %% to kernel interfaces */ 2 bind %%:sys_k log to kernel:sys_klog;2 bind %%:sys_kio to kernel:sys_kio; 3 3 bind %%:sys_tls to kernel:sys_tls; 4 4 bind %%:sys_thread to kernel:sys_thread; -
contrib/arch/uspace/lib/libc/protocol
r208b5f5 r6fa9a99d 1 1 /* Protocol according to which libc uses kernel syscalls */ 2 2 ( 3 !sys_k log.sys_klog+3 !sys_kio.sys_kio + 4 4 !sys_tls.sys_tls_set + 5 5 !sys_thread.sys_thread_create + -
contrib/arch/uspace/lib/libc/requires
r208b5f5 r6fa9a99d 1 1 /* Kernel interfaces required by libc */ 2 sys_k log sys_klog;2 sys_kio sys_kio; 3 3 sys_tls sys_tls; 4 4 sys_thread sys_thread; -
contrib/arch/uspace/lib/libc/subsume
r208b5f5 r6fa9a99d 1 1 /* Subsume %% to kernel interfaces */ 2 subsume %%:sys_k log to sys_klog;2 subsume %%:sys_kio to sys_kio; 3 3 subsume %%:sys_tls to sys_tls; 4 4 subsume %%:sys_thread to sys_thread; -
contrib/arch/uspace/srv/ns/ns.adl
r208b5f5 r6fa9a99d 6 6 sysarg_t ipc_m_connect_me_to(in sysarg_t service, in sysarg_t arg2, in sysarg_t arg3, in sysarg_t flags); 7 7 8 /* Share real-time clock page or k logpage */8 /* Share real-time clock page or kio page */ 9 9 sysarg_t ipc_m_share_in(in sysarg_t as_area_base, in sysarg_t as_area_size, in sysarg_t service); 10 10 -
kernel/doc/doxygroups.h
r208b5f5 r6fa9a99d 167 167 */ 168 168 169 /** @defgroup generick log KLog170 * @brief Kernel loggingfacility169 /** @defgroup generickio KIO 170 * @brief Kernel character input/output facility 171 171 * @ingroup genericconsole 172 172 */ -
kernel/generic/include/console/console.h
r208b5f5 r6fa9a99d 62 62 extern void console_init(void); 63 63 64 extern void k log_init(void);65 extern void k log_update(void *);64 extern void kio_init(void); 65 extern void kio_update(void *); 66 66 67 67 extern wchar_t getc(indev_t *indev); 68 68 extern size_t gets(indev_t *indev, char *buf, size_t buflen); 69 extern sysarg_t sys_k log(int cmd, const void *buf, size_t size);69 extern sysarg_t sys_kio(int cmd, const void *buf, size_t size); 70 70 71 71 extern void grab_console(void); -
kernel/generic/src/console/console.c
r208b5f5 r6fa9a99d 52 52 #include <errno.h> 53 53 #include <str.h> 54 #include <abi/k log.h>55 56 #define K LOG_PAGES 857 #define K LOG_LENGTH (KLOG_PAGES * PAGE_SIZE / sizeof(wchar_t))54 #include <abi/kio.h> 55 56 #define KIO_PAGES 8 57 #define KIO_LENGTH (KIO_PAGES * PAGE_SIZE / sizeof(wchar_t)) 58 58 59 59 /** Kernel log cyclic buffer */ 60 wchar_t k log[KLOG_LENGTH] __attribute__((aligned(PAGE_SIZE)));60 wchar_t kio[KIO_LENGTH] __attribute__((aligned(PAGE_SIZE))); 61 61 62 62 /** Kernel log initialized */ 63 static atomic_t k log_inited = {false};63 static atomic_t kio_inited = {false}; 64 64 65 65 /** First kernel log characters */ 66 static size_t k log_start = 0;66 static size_t kio_start = 0; 67 67 68 68 /** Number of valid kernel log characters */ 69 static size_t k log_len = 0;69 static size_t kio_len = 0; 70 70 71 71 /** Number of stored (not printed) kernel log characters */ 72 static size_t k log_stored = 0;72 static size_t kio_stored = 0; 73 73 74 74 /** Number of stored kernel log characters for uspace */ 75 static size_t k log_uspace = 0;75 static size_t kio_uspace = 0; 76 76 77 77 /** Kernel log spinlock */ 78 SPINLOCK_STATIC_INITIALIZE_NAME(k log_lock, "klog_lock");79 80 /** Physical memory area used for k logbuffer */81 static parea_t k log_parea;78 SPINLOCK_STATIC_INITIALIZE_NAME(kio_lock, "kio_lock"); 79 80 /** Physical memory area used for kio buffer */ 81 static parea_t kio_parea; 82 82 83 83 static indev_t stdin_sink; … … 146 146 * 147 147 */ 148 void k log_init(void)149 { 150 void *faddr = (void *) KA2PA(k log);148 void kio_init(void) 149 { 150 void *faddr = (void *) KA2PA(kio); 151 151 152 152 ASSERT((uintptr_t) faddr % FRAME_SIZE == 0); 153 153 154 k log_parea.pbase = (uintptr_t) faddr;155 k log_parea.frames = SIZE2FRAMES(sizeof(klog));156 k log_parea.unpriv = false;157 k log_parea.mapped = false;158 ddi_parea_register(&k log_parea);159 160 sysinfo_set_item_val("k log.faddr", NULL, (sysarg_t) faddr);161 sysinfo_set_item_val("k log.pages", NULL, KLOG_PAGES);162 163 event_set_unmask_callback(EVENT_K LOG, klog_update);164 atomic_set(&k log_inited, true);154 kio_parea.pbase = (uintptr_t) faddr; 155 kio_parea.frames = SIZE2FRAMES(sizeof(kio)); 156 kio_parea.unpriv = false; 157 kio_parea.mapped = false; 158 ddi_parea_register(&kio_parea); 159 160 sysinfo_set_item_val("kio.faddr", NULL, (sysarg_t) faddr); 161 sysinfo_set_item_val("kio.pages", NULL, KIO_PAGES); 162 163 event_set_unmask_callback(EVENT_KIO, kio_update); 164 atomic_set(&kio_inited, true); 165 165 } 166 166 … … 247 247 } 248 248 249 void k log_update(void *event)250 { 251 if (!atomic_get(&k log_inited))249 void kio_update(void *event) 250 { 251 if (!atomic_get(&kio_inited)) 252 252 return; 253 253 254 spinlock_lock(&k log_lock);255 256 if (k log_uspace > 0) {257 if (event_notify_3(EVENT_K LOG, true, klog_start, klog_len,258 k log_uspace) == EOK)259 k log_uspace = 0;260 } 261 262 spinlock_unlock(&k log_lock);254 spinlock_lock(&kio_lock); 255 256 if (kio_uspace > 0) { 257 if (event_notify_3(EVENT_KIO, true, kio_start, kio_len, 258 kio_uspace) == EOK) 259 kio_uspace = 0; 260 } 261 262 spinlock_unlock(&kio_lock); 263 263 } 264 264 … … 267 267 bool ordy = ((stdout) && (stdout->op->write)); 268 268 269 spinlock_lock(&k log_lock);269 spinlock_lock(&kio_lock); 270 270 271 271 /* Print charaters stored in kernel log */ 272 272 if (ordy) { 273 while (k log_stored > 0) {274 wchar_t tmp = k log[(klog_start + klog_len - klog_stored) % KLOG_LENGTH];275 k log_stored--;273 while (kio_stored > 0) { 274 wchar_t tmp = kio[(kio_start + kio_len - kio_stored) % KIO_LENGTH]; 275 kio_stored--; 276 276 277 277 /* … … 280 280 * the character. 281 281 */ 282 spinlock_unlock(&k log_lock);282 spinlock_unlock(&kio_lock); 283 283 stdout->op->write(stdout, tmp); 284 spinlock_lock(&k log_lock);284 spinlock_lock(&kio_lock); 285 285 } 286 286 } 287 287 288 288 /* Store character in the cyclic kernel log */ 289 k log[(klog_start + klog_len) % KLOG_LENGTH] = ch;290 if (k log_len < KLOG_LENGTH)291 k log_len++;289 kio[(kio_start + kio_len) % KIO_LENGTH] = ch; 290 if (kio_len < KIO_LENGTH) 291 kio_len++; 292 292 else 293 k log_start = (klog_start + 1) % KLOG_LENGTH;293 kio_start = (kio_start + 1) % KIO_LENGTH; 294 294 295 295 if (!ordy) { 296 if (k log_stored < klog_len)297 k log_stored++;296 if (kio_stored < kio_len) 297 kio_stored++; 298 298 } 299 299 300 300 /* The character is stored for uspace */ 301 if (k log_uspace < klog_len)302 k log_uspace++;303 304 spinlock_unlock(&k log_lock);301 if (kio_uspace < kio_len) 302 kio_uspace++; 303 304 spinlock_unlock(&kio_lock); 305 305 306 306 if (ordy) { … … 326 326 /* Force notification on newline */ 327 327 if (ch == '\n') 328 k log_update(NULL);328 kio_update(NULL); 329 329 } 330 330 … … 334 334 * 335 335 */ 336 sysarg_t sys_k log(int cmd, const void *buf, size_t size)336 sysarg_t sys_kio(int cmd, const void *buf, size_t size) 337 337 { 338 338 char *data; … … 340 340 341 341 switch (cmd) { 342 case K LOG_UPDATE:343 k log_update(NULL);342 case KIO_UPDATE: 343 kio_update(NULL); 344 344 return EOK; 345 case K LOG_WRITE:346 case K LOG_COMMAND:345 case KIO_WRITE: 346 case KIO_COMMAND: 347 347 break; 348 348 default: … … 366 366 367 367 switch (cmd) { 368 case K LOG_WRITE:368 case KIO_WRITE: 369 369 printf("%s", data); 370 370 break; 371 case K LOG_COMMAND:371 case KIO_COMMAND: 372 372 if (!stdin) 373 373 break; -
kernel/generic/src/main/main.c
r208b5f5 r6fa9a99d 281 281 ipc_init(); 282 282 event_init(); 283 k log_init();283 kio_init(); 284 284 stats_init(); 285 285 -
kernel/generic/src/syscall/syscall.c
r208b5f5 r6fa9a99d 120 120 syshandler_t syscall_table[SYSCALL_END] = { 121 121 /* System management syscalls. */ 122 (syshandler_t) sys_k log,122 (syshandler_t) sys_kio, 123 123 (syshandler_t) sys_tls_set, 124 124 -
uspace/Makefile
r208b5f5 r6fa9a99d 50 50 app/kill \ 51 51 app/killall \ 52 app/k log\52 app/kio \ 53 53 app/loc \ 54 54 app/logset \ -
uspace/app/kio/Makefile
r208b5f5 r6fa9a99d 31 31 LIBS = $(LIBCLUI_PREFIX)/libclui.a 32 32 EXTRA_CFLAGS = -I$(LIBCLUI_PREFIX) 33 BINARY = k log33 BINARY = kio 34 34 35 35 SOURCES = \ 36 k log.c36 kio.c 37 37 38 38 include $(USPACE_PREFIX)/Makefile.common -
uspace/app/kio/kio.c
r208b5f5 r6fa9a99d 27 27 */ 28 28 29 /** @addtogroup k log KLog30 * @brief HelenOS K Log29 /** @addtogroup kio KIO 30 * @brief HelenOS KIO 31 31 * @{ 32 32 */ … … 42 42 #include <errno.h> 43 43 #include <str_error.h> 44 #include <io/k log.h>44 #include <io/kio.h> 45 45 #include <sysinfo.h> 46 46 #include <malloc.h> … … 50 50 #include <tinput.h> 51 51 52 #define NAME "k log"53 #define LOG_FNAME "/log/k log"52 #define NAME "kio" 53 #define LOG_FNAME "/log/kio" 54 54 55 55 /* Producer/consumer buffers */ … … 62 62 static prodcons_t pc; 63 63 64 /* Pointer to k logarea */65 static wchar_t *k log;66 static size_t k log_length;64 /* Pointer to kio area */ 65 static wchar_t *kio; 66 static size_t kio_length; 67 67 68 68 /* Notification mutex */ … … 75 75 * 76 76 * @param length Number of characters to copy. 77 * @param data Pointer to the kernel k logbuffer.77 * @param data Pointer to the kernel kio buffer. 78 78 * 79 79 */ … … 142 142 /** Kernel notification handler 143 143 * 144 * Receives kernel k lognotifications.144 * Receives kernel kio notifications. 145 145 * 146 146 * @param callid IPC call ID … … 156 156 * starving. 157 157 * 158 * Note: Usually the automatic masking of the k log158 * Note: Usually the automatic masking of the kio 159 159 * notifications on the kernel side does the trick 160 160 * of limiting the chance of accidentally copying 161 161 * the same data multiple times. However, due to 162 * the non-blocking architecture of k lognotifications,162 * the non-blocking architecture of kio notifications, 163 163 * this possibility cannot be generally avoided. 164 164 */ … … 166 166 fibril_mutex_lock(&mtx); 167 167 168 size_t k log_start = (size_t) IPC_GET_ARG1(*call);169 size_t k log_len = (size_t) IPC_GET_ARG2(*call);170 size_t k log_stored = (size_t) IPC_GET_ARG3(*call);171 172 size_t offset = (k log_start + klog_len - klog_stored) % klog_length;168 size_t kio_start = (size_t) IPC_GET_ARG1(*call); 169 size_t kio_len = (size_t) IPC_GET_ARG2(*call); 170 size_t kio_stored = (size_t) IPC_GET_ARG3(*call); 171 172 size_t offset = (kio_start + kio_len - kio_stored) % kio_length; 173 173 174 174 /* Copy data from the ring buffer */ 175 if (offset + k log_stored >= klog_length) {176 size_t split = k log_length - offset;177 178 producer(split, k log+ offset);179 producer(k log_stored - split, klog);175 if (offset + kio_stored >= kio_length) { 176 size_t split = kio_length - offset; 177 178 producer(split, kio + offset); 179 producer(kio_stored - split, kio); 180 180 } else 181 producer(k log_stored, klog+ offset);182 183 event_unmask(EVENT_K LOG);181 producer(kio_stored, kio + offset); 182 183 event_unmask(EVENT_KIO); 184 184 fibril_mutex_unlock(&mtx); 185 185 } … … 188 188 { 189 189 size_t pages; 190 int rc = sysinfo_get_value("k log.pages", &pages);191 if (rc != EOK) { 192 fprintf(stderr, "%s: Unable to get number of k logpages\n",190 int rc = sysinfo_get_value("kio.pages", &pages); 191 if (rc != EOK) { 192 fprintf(stderr, "%s: Unable to get number of kio pages\n", 193 193 NAME); 194 194 return rc; … … 196 196 197 197 uintptr_t faddr; 198 rc = sysinfo_get_value("k log.faddr", &faddr);199 if (rc != EOK) { 200 fprintf(stderr, "%s: Unable to get k logphysical address\n",198 rc = sysinfo_get_value("kio.faddr", &faddr); 199 if (rc != EOK) { 200 fprintf(stderr, "%s: Unable to get kio physical address\n", 201 201 NAME); 202 202 return rc; … … 204 204 205 205 size_t size = pages * PAGE_SIZE; 206 k log_length = size / sizeof(wchar_t);206 kio_length = size / sizeof(wchar_t); 207 207 208 208 rc = physmem_map(faddr, pages, AS_AREA_READ | AS_AREA_CACHEABLE, 209 (void *) &k log);210 if (rc != EOK) { 211 fprintf(stderr, "%s: Unable to map k log\n", NAME);209 (void *) &kio); 210 if (rc != EOK) { 211 fprintf(stderr, "%s: Unable to map kio\n", NAME); 212 212 return rc; 213 213 } … … 215 215 prodcons_initialize(&pc); 216 216 async_set_interrupt_received(notification_received); 217 rc = event_subscribe(EVENT_K LOG, 0);218 if (rc != EOK) { 219 fprintf(stderr, "%s: Unable to register k lognotifications\n",217 rc = event_subscribe(EVENT_KIO, 0); 218 if (rc != EOK) { 219 fprintf(stderr, "%s: Unable to register kio notifications\n", 220 220 NAME); 221 221 return rc; … … 236 236 237 237 fibril_add_ready(fid); 238 event_unmask(EVENT_K LOG);239 k log_update();240 241 tinput_set_prompt(input, "k log> ");238 event_unmask(EVENT_KIO); 239 kio_update(); 240 241 tinput_set_prompt(input, "kio> "); 242 242 243 243 char *str; … … 248 248 } 249 249 250 k log_command(str, str_size(str));250 kio_command(str, str_size(str)); 251 251 free(str); 252 252 } -
uspace/app/trace/syscalls.c
r208b5f5 r6fa9a99d 38 38 39 39 const sc_desc_t syscall_desc[] = { 40 [SYS_K LOG] ={ "klog",3, V_INT_ERRNO },40 [SYS_KIO] ={ "kio", 3, V_INT_ERRNO }, 41 41 [SYS_TLS_SET] = { "tls_set", 1, V_ERRNO }, 42 42 -
uspace/lib/c/Makefile
r208b5f5 r6fa9a99d 107 107 generic/io/log.c \ 108 108 generic/io/logctl.c \ 109 generic/io/k log.c \109 generic/io/kio.c \ 110 110 generic/io/snprintf.c \ 111 111 generic/io/vprintf.c \ -
uspace/lib/c/generic/assert.c
r208b5f5 r6fa9a99d 33 33 #include <assert.h> 34 34 #include <stdio.h> 35 #include <io/k log.h>35 #include <io/kio.h> 36 36 #include <stdlib.h> 37 37 #include <atomic.h> … … 44 44 { 45 45 /* 46 * Send the message safely to k log. Nested asserts should not occur.46 * Send the message safely to kio. Nested asserts should not occur. 47 47 */ 48 k log_printf("Assertion failed (%s) in file \"%s\", line %u.\n",48 kio_printf("Assertion failed (%s) in file \"%s\", line %u.\n", 49 49 cond, file, line); 50 50 -
uspace/lib/c/generic/io/io.c
r208b5f5 r6fa9a99d 42 42 #include <malloc.h> 43 43 #include <async.h> 44 #include <io/k log.h>44 #include <io/kio.h> 45 45 #include <vfs/vfs.h> 46 46 #include <vfs/vfs_sess.h> … … 57 57 .error = true, 58 58 .eof = true, 59 .k log= false,59 .kio = false, 60 60 .sess = NULL, 61 61 .btype = _IONBF, … … 67 67 }; 68 68 69 static FILE stdout_k log= {69 static FILE stdout_kio = { 70 70 .fd = -1, 71 71 .error = false, 72 72 .eof = false, 73 .k log= true,73 .kio = true, 74 74 .sess = NULL, 75 75 .btype = _IOLBF, … … 81 81 }; 82 82 83 static FILE stderr_k log= {83 static FILE stderr_kio = { 84 84 .fd = -1, 85 85 .error = false, 86 86 .eof = false, 87 .k log= true,87 .kio = true, 88 88 .sess = NULL, 89 89 .btype = _IONBF, … … 113 113 stdout = fdopen(1, "w"); 114 114 } else { 115 stdout = &stdout_k log;115 stdout = &stdout_kio; 116 116 list_append(&stdout->link, &files); 117 117 } … … 120 120 stderr = fdopen(2, "w"); 121 121 } else { 122 stderr = &stderr_k log;122 stderr = &stderr_kio; 123 123 list_append(&stderr->link, &files); 124 124 } … … 267 267 stream->error = false; 268 268 stream->eof = false; 269 stream->k log= false;269 stream->kio = false; 270 270 stream->sess = NULL; 271 271 stream->need_sync = false; … … 289 289 stream->error = false; 290 290 stream->eof = false; 291 stream->k log= false;291 stream->kio = false; 292 292 stream->sess = NULL; 293 293 stream->need_sync = false; … … 314 314 315 315 if ((stream != &stdin_null) 316 && (stream != &stdout_k log)317 && (stream != &stderr_k log))316 && (stream != &stdout_kio) 317 && (stream != &stderr_kio)) 318 318 free(stream); 319 319 … … 382 382 ssize_t wr; 383 383 384 if (stream->k log)385 wr = k log_write(buf + done, left);384 if (stream->kio) 385 wr = kio_write(buf + done, left); 386 386 else 387 387 wr = write(stream->fd, buf + done, left); … … 705 705 _fflushbuf(stream); 706 706 707 if (stream->k log) {708 k log_update();707 if (stream->kio) { 708 kio_update(); 709 709 return EOK; 710 710 } … … 740 740 int fileno(FILE *stream) 741 741 { 742 if (stream->k log) {742 if (stream->kio) { 743 743 errno = EBADF; 744 744 return -1; -
uspace/lib/c/generic/io/kio.c
r208b5f5 r6fa9a99d 39 39 #include <unistd.h> 40 40 #include <errno.h> 41 #include <abi/k log.h>42 #include <io/k log.h>41 #include <abi/kio.h> 42 #include <io/kio.h> 43 43 #include <io/printf_core.h> 44 44 45 size_t k log_write(const void *buf, size_t size)45 size_t kio_write(const void *buf, size_t size) 46 46 { 47 ssize_t ret = (ssize_t) __SYSCALL3(SYS_K LOG, KLOG_WRITE, (sysarg_t) buf, size);47 ssize_t ret = (ssize_t) __SYSCALL3(SYS_KIO, KIO_WRITE, (sysarg_t) buf, size); 48 48 49 49 if (ret >= 0) … … 53 53 } 54 54 55 void k log_update(void)55 void kio_update(void) 56 56 { 57 (void) __SYSCALL3(SYS_K LOG, KLOG_UPDATE, (uintptr_t) NULL, 0);57 (void) __SYSCALL3(SYS_KIO, KIO_UPDATE, (uintptr_t) NULL, 0); 58 58 } 59 59 60 void k log_command(const void *buf, size_t size)60 void kio_command(const void *buf, size_t size) 61 61 { 62 (void) __SYSCALL3(SYS_K LOG, KLOG_COMMAND, (sysarg_t) buf, (sysarg_t) size);62 (void) __SYSCALL3(SYS_KIO, KIO_COMMAND, (sysarg_t) buf, (sysarg_t) size); 63 63 } 64 64 65 /** Print formatted text to k log.65 /** Print formatted text to kio. 66 66 * 67 67 * @param fmt Format string … … 70 70 * 71 71 */ 72 int k log_printf(const char *fmt, ...)72 int kio_printf(const char *fmt, ...) 73 73 { 74 74 va_list args; 75 75 va_start(args, fmt); 76 76 77 int ret = k log_vprintf(fmt, args);77 int ret = kio_vprintf(fmt, args); 78 78 79 79 va_end(args); … … 82 82 } 83 83 84 static int k log_vprintf_str_write(const char *str, size_t size, void *data)84 static int kio_vprintf_str_write(const char *str, size_t size, void *data) 85 85 { 86 size_t wr = k log_write(str, size);86 size_t wr = kio_write(str, size); 87 87 return str_nlength(str, wr); 88 88 } 89 89 90 static int k log_vprintf_wstr_write(const wchar_t *str, size_t size, void *data)90 static int kio_vprintf_wstr_write(const wchar_t *str, size_t size, void *data) 91 91 { 92 92 size_t offset = 0; … … 98 98 99 99 if (chr_encode(str[chars], buf, &sz, STR_BOUNDS(1)) == EOK) 100 k log_write(buf, sz);100 kio_write(buf, sz); 101 101 102 102 chars++; … … 107 107 } 108 108 109 /** Print formatted text to k log.109 /** Print formatted text to kio. 110 110 * 111 111 * @param fmt Format string … … 115 115 * 116 116 */ 117 int k log_vprintf(const char *fmt, va_list ap)117 int kio_vprintf(const char *fmt, va_list ap) 118 118 { 119 119 printf_spec_t ps = { 120 k log_vprintf_str_write,121 k log_vprintf_wstr_write,120 kio_vprintf_str_write, 121 kio_vprintf_wstr_write, 122 122 NULL 123 123 }; -
uspace/lib/c/generic/private/stdio.h
r208b5f5 r6fa9a99d 53 53 int eof; 54 54 55 /** K logindicator */56 int k log;55 /** KIO indicator */ 56 int kio; 57 57 58 58 /** Session to the file provider */ -
uspace/lib/c/include/io/kio.h
r208b5f5 r6fa9a99d 33 33 */ 34 34 35 #ifndef LIBC_IO_K LOG_H_36 #define LIBC_IO_K LOG_H_35 #ifndef LIBC_IO_KIO_H_ 36 #define LIBC_IO_KIO_H_ 37 37 38 38 #include <sys/types.h> … … 40 40 #include <io/verify.h> 41 41 42 extern size_t k log_write(const void *, size_t);43 extern void k log_update(void);44 extern void k log_command(const void *, size_t);45 extern int k log_printf(const char *, ...)42 extern size_t kio_write(const void *, size_t); 43 extern void kio_update(void); 44 extern void kio_command(const void *, size_t); 45 extern int kio_printf(const char *, ...) 46 46 PRINTF_ATTRIBUTE(1, 2); 47 extern int k log_vprintf(const char *, va_list);47 extern int kio_vprintf(const char *, va_list); 48 48 49 49 #endif -
uspace/lib/c/include/stdio.h
r208b5f5 r6fa9a99d 40 40 #include <str.h> 41 41 #include <io/verify.h> 42 #include <abi/k log.h>42 #include <abi/kio.h> 43 43 44 44 #define EOF (-1) … … 52 52 int _n = snprintf(_buf, sizeof(_buf), fmt, ##__VA_ARGS__); \ 53 53 if (_n > 0) \ 54 (void) __SYSCALL3(SYS_K LOG, KLOG_WRITE, (sysarg_t) _buf, str_size(_buf)); \54 (void) __SYSCALL3(SYS_KIO, KIO_WRITE, (sysarg_t) _buf, str_size(_buf)); \ 55 55 } 56 56
Note:
See TracChangeset
for help on using the changeset viewer.