vere: export term.c:_write() as u3_write_fd(), use in dprintf() replacement

This commit is contained in:
~locpyl-tidnyd 2021-03-29 12:14:59 +00:00 committed by fang
parent f06471cb31
commit 0ddde0b0d6
No known key found for this signature in database
GPG Key ID: EB035760C1BBA972
2 changed files with 9 additions and 5 deletions

View File

@ -1364,6 +1364,10 @@
void void
u3_king_grab(void* ptr_v); u3_king_grab(void* ptr_v);
/* u3_write_fd(): retry interrupts, continue partial writes, assert errors.
*/
void
u3_write_fd(c3_i fid_i, const void* buf_v, size_t len_i);
c3_w c3_w
u3_readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result); u3_readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);

View File

@ -28,10 +28,10 @@ static void _term_read_cb(uv_stream_t* tcp_u,
static c3_i _term_tcsetattr(c3_i, c3_i, const struct termios*); static c3_i _term_tcsetattr(c3_i, c3_i, const struct termios*);
static void _term_it_send_stub(u3_utty* uty_u, u3_noun tub); static void _term_it_send_stub(u3_utty* uty_u, u3_noun tub);
/* _write(): retry interrupts, continue partial writes, assert errors. /* u3_write_fd(): retry interrupts, continue partial writes, assert errors.
*/ */
static void void
_write(c3_i fid_i, const void* buf_v, size_t len_i) u3_write_fd(c3_i fid_i, const void* buf_v, size_t len_i)
{ {
ssize_t ret_i; ssize_t ret_i;
@ -55,7 +55,7 @@ _write(c3_i fid_i, const void* buf_v, size_t len_i)
// assert on true errors // assert on true errors
// //
// NB: can't call u3l_log here or we would re-enter _write() // NB: can't call u3l_log here or we would re-enter u3_write_fd()
// //
if ( ret_i < 0 ) { if ( ret_i < 0 ) {
fprintf(stderr, "term: write failed %s\r\n", strerror(errno)); fprintf(stderr, "term: write failed %s\r\n", strerror(errno));
@ -253,7 +253,7 @@ u3_term_log_exit(void)
if ( -1 == fcntl(uty_u->fid_i, F_SETFL, uty_u->cug_i) ) { if ( -1 == fcntl(uty_u->fid_i, F_SETFL, uty_u->cug_i) ) {
c3_assert(!"exit-fcntl"); c3_assert(!"exit-fcntl");
} }
_write(uty_u->fid_i, "\r\n", 2); u3_write_fd(uty_u->fid_i, "\r\n", 2);
} }
} }