make stdio open, read, and write operations cancellation points
it should be noted that only the actual underlying buffer flush and fill operations are cancellable, not reads from or writes to the buffer. this behavior is compatible with POSIX, which makes all cancellation points in stdio optional, and it achieves the goal of allowing cancellation of a thread that's "stuck" on IO (due to a non-responsive socket/pipe peer, slow/stuck hardware, etc.) without imposing any measurable performance cost.
This commit is contained in:
parent
4948a24df2
commit
5816592389
3 changed files with 28 additions and 5 deletions
|
|
@ -21,7 +21,7 @@ FILE *fopen(const char *filename, const char *mode)
|
|||
if (*mode == 'w') flags |= O_TRUNC;
|
||||
if (*mode == 'a') flags |= O_APPEND;
|
||||
|
||||
fd = syscall(SYS_open, filename, flags|O_LARGEFILE, 0666);
|
||||
fd = syscall_cp(SYS_open, filename, flags|O_LARGEFILE, 0666);
|
||||
if (fd < 0) return 0;
|
||||
|
||||
f = __fdopen(fd, mode);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue