/[base]
ViewVC logotype

Revision 320472


Jump to revision: Previous Next
Author: kib
Date: Thu Jun 29 14:44:17 2017 UTC (7 years ago)
Changed paths: 38
Log Message:
Make stdio deferred cancel-safe.

If used with fopen(3)/fdopen(3)-ed FILEs, stdio accurately uses
non-cancellable internal versions of the functions, i.e. it seems to
be fine with regard to cancellation.  But if the funopen(3) and
f{r,w}open(3) functions were used to open the FILE, and corresponding
user functions create cancellation points (they typically have no
other choice), then stdio code at least leaks FILE' lock.

The change installs cleanup handler which unlocks FILE.  Some minimal
restructuring of the code was required to make it use common return
place to satisfy hand-rolled pthread_cleanup_pop() requirements.

Noted by:	eugen
Reviewed by:	eugen, vangyzen
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D11246


Changed paths

Path Details
Directoryhead/lib/libc/stdio/fclose.c modified , text changed
Directoryhead/lib/libc/stdio/fflush.c modified , text changed
Directoryhead/lib/libc/stdio/fgetc.c modified , text changed
Directoryhead/lib/libc/stdio/fgetln.c modified , text changed
Directoryhead/lib/libc/stdio/fgets.c modified , text changed
Directoryhead/lib/libc/stdio/fgetwc.c modified , text changed
Directoryhead/lib/libc/stdio/fgetwln.c modified , text changed
Directoryhead/lib/libc/stdio/fgetws.c modified , text changed
Directoryhead/lib/libc/stdio/fputc.c modified , text changed
Directoryhead/lib/libc/stdio/fputs.c modified , text changed
Directoryhead/lib/libc/stdio/fputwc.c modified , text changed
Directoryhead/lib/libc/stdio/fputws.c modified , text changed
Directoryhead/lib/libc/stdio/fread.c modified , text changed
Directoryhead/lib/libc/stdio/freopen.c modified , text changed
Directoryhead/lib/libc/stdio/fscanf.c modified , text changed
Directoryhead/lib/libc/stdio/fseek.c modified , text changed
Directoryhead/lib/libc/stdio/fwrite.c modified , text changed
Directoryhead/lib/libc/stdio/getc.c modified , text changed
Directoryhead/lib/libc/stdio/getchar.c modified , text changed
Directoryhead/lib/libc/stdio/getdelim.c modified , text changed
Directoryhead/lib/libc/stdio/gets.c modified , text changed
Directoryhead/lib/libc/stdio/local.h modified , text changed
Directoryhead/lib/libc/stdio/perror.c modified , text changed
Directoryhead/lib/libc/stdio/putc.c modified , text changed
Directoryhead/lib/libc/stdio/putchar.c modified , text changed
Directoryhead/lib/libc/stdio/puts.c modified , text changed
Directoryhead/lib/libc/stdio/putw.c modified , text changed
Directoryhead/lib/libc/stdio/refill.c modified , text changed
Directoryhead/lib/libc/stdio/scanf.c modified , text changed
Directoryhead/lib/libc/stdio/setvbuf.c modified , text changed
Directoryhead/lib/libc/stdio/stdio.c modified , text changed
Directoryhead/lib/libc/stdio/ungetc.c modified , text changed
Directoryhead/lib/libc/stdio/ungetwc.c modified , text changed
Directoryhead/lib/libc/stdio/vfprintf.c modified , text changed
Directoryhead/lib/libc/stdio/vfscanf.c modified , text changed
Directoryhead/lib/libc/stdio/vfwprintf.c modified , text changed
Directoryhead/lib/libc/stdio/vfwscanf.c modified , text changed
Directoryhead/lib/libc/stdio/vscanf.c modified , text changed

  ViewVC Help
Powered by ViewVC 1.1.27