| 17 | EM_JS_DEPS(main, "$ERRNO_CODES"); |
| 18 | |
| 19 | void setup(void) { |
| 20 | EM_ASM( |
| 21 | var device = FS.makedev(80, 0); |
| 22 | FS.registerDevice(device, { |
| 23 | write: function(stream, buffer, offset, length, pos) { |
| 24 | if (length === 0) { |
| 25 | return 0; |
| 26 | } |
| 27 | // Only do a partial write of one byte each time |
| 28 | out('TO DEVICE: ' + JSON.stringify(String.fromCharCode(buffer[offset]))); |
| 29 | return 1; |
| 30 | } |
| 31 | }); |
| 32 | FS.mkdev('/device', device); |
| 33 | ); |
| 34 | } |
| 35 | |
| 36 | // Run the test with writev directly |
| 37 | void test_writev_direct(void) { |