Changeset 690ad20 in mainline for uspace/app/kio/kio.c
- Timestamp:
- 2025-04-17T15:29:16Z (5 days ago)
- Branches:
- master
- Children:
- 39e1b9a
- Parents:
- d5b37b6
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2025-04-11 20:06:16)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2025-04-17 15:29:16)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/kio/kio.c
rd5b37b6 r690ad20 59 59 typedef struct { 60 60 link_t link; 61 size_t length;62 char 32_t*data;61 size_t bytes; 62 char *data; 63 63 } item_t; 64 64 … … 68 68 static FIBRIL_MUTEX_INITIALIZE(mtx); 69 69 70 #define READ_BUFFER_SIZE (PAGE_SIZE / sizeof(char32_t))70 #define READ_BUFFER_SIZE PAGE_SIZE 71 71 72 72 static size_t current_at; 73 static char 32_tread_buffer[READ_BUFFER_SIZE];73 static char read_buffer[READ_BUFFER_SIZE]; 74 74 75 75 /** Klog producer … … 82 82 * 83 83 */ 84 static void producer(size_t length, char32_t*data)85 { 86 item_t *item = (item_t *)malloc(sizeof(item_t));84 static void producer(size_t bytes, char *data) 85 { 86 item_t *item = malloc(sizeof(item_t)); 87 87 if (item == NULL) 88 88 return; 89 89 90 size_t sz = sizeof(char32_t) * length;91 char32_t *buf = (char32_t *) malloc(sz);92 if ( buf == NULL) {90 item->bytes = bytes; 91 item->data = malloc(bytes); 92 if (!item->data) { 93 93 free(item); 94 94 return; 95 95 } 96 96 97 memcpy( buf, data, sz);97 memcpy(item->data, data, bytes); 98 98 99 99 link_initialize(&item->link); 100 item->length = length;101 item->data = buf;102 100 prodcons_produce(&pc, &item->link); 103 101 } … … 125 123 item_t *item = list_get_instance(link, item_t, link); 126 124 127 for (size_t i = 0; i < item->length; i++) 128 putuchar(item->data[i]); 129 130 if (log != NULL) { 131 for (size_t i = 0; i < item->length; i++) 132 fputuc(item->data[i], log); 133 125 fwrite(item->data, 1, item->bytes, stdout); 126 127 if (log) { 128 fwrite(item->data, 1, item->bytes, log); 134 129 fflush(log); 135 130 vfs_sync(fileno(log));
Note:
See TracChangeset
for help on using the changeset viewer.