Changeset a35b458 in mainline for uspace/app/kio/kio.c
- Timestamp:
- 2018-03-02T20:10:49Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f1380b7
- Parents:
- 3061bc1
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/kio/kio.c
r3061bc1 ra35b458 83 83 if (item == NULL) 84 84 return; 85 85 86 86 size_t sz = sizeof(wchar_t) * length; 87 87 wchar_t *buf = (wchar_t *) malloc(sz); … … 90 90 return; 91 91 } 92 92 93 93 memcpy(buf, data, sz); 94 94 95 95 link_initialize(&item->link); 96 96 item->length = length; … … 116 116 printf("%s: Unable to create log file %s (%s)\n", NAME, LOG_FNAME, 117 117 str_error(errno)); 118 118 119 119 while (true) { 120 120 link_t *link = prodcons_consume(&pc); 121 121 item_t *item = list_get_instance(link, item_t, link); 122 122 123 123 for (size_t i = 0; i < item->length; i++) 124 124 putchar(item->data[i]); 125 125 126 126 if (log != NULL) { 127 127 for (size_t i = 0; i < item->length; i++) 128 128 fputc(item->data[i], log); 129 129 130 130 fflush(log); 131 131 vfs_sync(fileno(log)); 132 132 } 133 133 134 134 free(item->data); 135 135 free(item); 136 136 } 137 137 138 138 fclose(log); 139 139 return EOK; … … 162 162 * this possibility cannot be generally avoided. 163 163 */ 164 164 165 165 fibril_mutex_lock(&mtx); 166 166 167 167 size_t kio_start = (size_t) IPC_GET_ARG1(*call); 168 168 size_t kio_len = (size_t) IPC_GET_ARG2(*call); 169 169 size_t kio_stored = (size_t) IPC_GET_ARG3(*call); 170 170 171 171 size_t offset = (kio_start + kio_len - kio_stored) % kio_length; 172 172 173 173 /* Copy data from the ring buffer */ 174 174 if (offset + kio_stored >= kio_length) { 175 175 size_t split = kio_length - offset; 176 176 177 177 producer(split, kio + offset); 178 178 producer(kio_stored - split, kio); 179 179 } else 180 180 producer(kio_stored, kio + offset); 181 181 182 182 async_event_unmask(EVENT_KIO); 183 183 fibril_mutex_unlock(&mtx); … … 193 193 return rc; 194 194 } 195 195 196 196 uintptr_t faddr; 197 197 rc = sysinfo_get_value("kio.faddr", &faddr); … … 201 201 return rc; 202 202 } 203 203 204 204 size_t size = pages * PAGE_SIZE; 205 205 kio_length = size / sizeof(wchar_t); 206 206 207 207 rc = physmem_map(faddr, pages, AS_AREA_READ | AS_AREA_CACHEABLE, 208 208 (void *) &kio); … … 211 211 return rc; 212 212 } 213 213 214 214 prodcons_initialize(&pc); 215 215 rc = async_event_subscribe(EVENT_KIO, kio_notification_handler, NULL); … … 219 219 return rc; 220 220 } 221 221 222 222 fid_t fid = fibril_create(consumer, NULL); 223 223 if (!fid) { … … 226 226 return ENOMEM; 227 227 } 228 228 229 229 tinput_t *input = tinput_new(); 230 230 if (!input) { … … 236 236 async_event_unmask(EVENT_KIO); 237 237 kio_update(); 238 238 239 239 tinput_set_prompt(input, "kio> "); 240 240
Note:
See TracChangeset
for help on using the changeset viewer.