Add i/o statistics to wait4() about child process

This commit is contained in:
Justine Tunney 2023-08-21 21:25:33 -07:00
parent b9eb656e41
commit 58ef4e6df8
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
6 changed files with 39 additions and 8 deletions

View file

@ -17,6 +17,7 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/fmt/fmt.h"
#include "libc/stdio/lock.internal.h"
#include "libc/stdio/stdio.h"
/**
@ -38,7 +39,11 @@ int fscanf(FILE *stream, const char *fmt, ...) {
int rc;
va_list va;
va_start(va, fmt);
rc = __vcscanf((int (*)(void *))fgetc, (void *)ungetc, stream, fmt, va);
flockfile(stream);
rc = __vcscanf((void *)fgetc_unlocked, //
(void *)ungetc_unlocked, //
stream, fmt, va);
funlockfile(stream);
va_end(va);
return rc;
}