Changes in kernel/generic/src/console/console.c [90dd8aee:63ed840] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/console/console.c
r90dd8aee r63ed840 34 34 */ 35 35 36 #include <abi/kio.h>37 #include <arch.h>38 36 #include <assert.h> 39 #include < atomic.h>37 #include <console/console.h> 40 38 #include <console/chardev.h> 41 #include <console/console.h> 39 #include <sysinfo/sysinfo.h> 40 #include <synch/waitq.h> 41 #include <synch/spinlock.h> 42 #include <typedefs.h> 43 #include <ddi/irq.h> 42 44 #include <ddi/ddi.h> 43 #include <ddi/irq.h>44 #include <errno.h>45 45 #include <ipc/event.h> 46 46 #include <ipc/irq.h> 47 #include <arch.h> 48 #include <panic.h> 49 #include <stdio.h> 50 #include <putchar.h> 51 #include <atomic.h> 52 #include <syscall/copy.h> 53 #include <errno.h> 54 #include <str.h> 55 #include <stdatomic.h> 56 #include <abi/kio.h> 47 57 #include <mm/frame.h> /* SIZE2FRAMES */ 48 #include <panic.h>49 #include <preemption.h>50 #include <proc/thread.h>51 #include <putchar.h>52 #include <stdatomic.h>53 #include <stdio.h>54 58 #include <stdlib.h> /* malloc */ 55 #include <str.h>56 #include <synch/mutex.h>57 #include <synch/spinlock.h>58 #include <synch/waitq.h>59 #include <syscall/copy.h>60 #include <sysinfo/sysinfo.h>61 #include <typedefs.h>62 59 63 60 #define KIO_PAGES 8 … … 69 66 /** Kernel log initialized */ 70 67 static atomic_bool kio_inited = ATOMIC_VAR_INIT(false); 71 72 /** A mutex for preventing interleaving of output lines from different threads.73 * May not be held in some circumstances, so locking of any internal shared74 * structures is still necessary.75 */76 static MUTEX_INITIALIZE(console_mutex, MUTEX_RECURSIVE);77 68 78 69 /** First kernel log characters */ … … 404 395 } 405 396 406 /** Lock console output, ensuring that lines from different threads don't407 * interleave. Does nothing when preemption is disabled, so that debugging408 * and error printouts in sensitive areas still work.409 */410 void console_lock(void)411 {412 if (!PREEMPTION_DISABLED)413 mutex_lock(&console_mutex);414 }415 416 /** Unlocks console output. See console_lock()417 */418 void console_unlock(void)419 {420 if (!PREEMPTION_DISABLED)421 mutex_unlock(&console_mutex);422 }423 424 397 /** @} 425 398 */
Note:
See TracChangeset
for help on using the changeset viewer.