Call __fsetlocking for temporary stream.

This commit is contained in:
Ulrich Drepper 2001-08-10 21:40:18 +00:00
parent c31c27256e
commit 0d875352b7
5 changed files with 28 additions and 4 deletions

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1995, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
/* Copyright (C) 1995, 1997-2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -27,6 +27,7 @@
#include "libioP.h"
#include "libio.h"
#include <stdio_ext.h>
int
_IO_vdprintf (d, format, arg)
@ -59,6 +60,9 @@ _IO_vdprintf (d, format, arg)
(_IO_mask_flags (&tmpfil.file, _IO_NO_READS,
_IO_NO_READS+_IO_NO_WRITES+_IO_IS_APPENDING)
| _IO_DELETE_DONT_CLOSE);
#ifdef _IO_MTSAFE_IO
__fsetlocking ((FILE *) &tmpfil, FSETLOCKING_BYCALLER);
#endif
done = _IO_vfprintf ((_IO_FILE *) &tmpfil, format, arg);

View file

@ -1,5 +1,5 @@
/* Print output of stream to given obstack.
Copyright (C) 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
Copyright (C) 1996, 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@ -28,6 +28,7 @@
#include <errno.h>
#include <obstack.h>
#include <stdarg.h>
#include <stdio_ext.h>
struct _IO_obstack_file
@ -166,6 +167,9 @@ _IO_obstack_vprintf (struct obstack *obstack, const char *format, va_list args)
obstack_blank_fast (obstack, room);
new_f.ofile.obstack = obstack;
#ifdef _IO_MTSAFE_IO
__fsetlocking ((FILE *) &new_f.ofile.file, FSETLOCKING_BYCALLER);
#endif
result = _IO_vfprintf ((_IO_FILE *) &new_f.ofile.file, format, args);

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1993, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1997-2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -28,6 +28,7 @@
#include "strfile.h"
#include "libioP.h"
#include <string.h>
#include <stdio_ext.h>
#if 0
/* The following definitions are for exposition only.
@ -107,6 +108,11 @@ _IO_str_init_static (sf, ptr, size, pstart)
}
/* A null _allocate_buffer function flags the strfile as being static. */
sf->_s._allocate_buffer = (_IO_alloc_type) 0;
#ifdef _IO_MTSAFE_IO
/* We never have to lock this stream. */
__fsetlocking ((FILE *) fp, FSETLOCKING_BYCALLER);
#endif
}
void

View file

@ -29,6 +29,7 @@
#include <string.h>
#include "libioP.h"
#include "stdio.h"
#include <stdio_ext.h>
#include "strfile.h"
int
@ -60,6 +61,9 @@ _IO_vasprintf (result_ptr, format, args)
sf._sbf._f._flags &= ~_IO_USER_BUF;
sf._s._allocate_buffer = (_IO_alloc_type) malloc;
sf._s._free_buffer = (_IO_free_type) free;
#ifdef _IO_MTSAFE_IO
__fsetlocking ((FILE *) &sf, FSETLOCKING_BYCALLER);
#endif
ret = _IO_vfprintf ((_IO_FILE *) &sf, format, args);
if (ret < 0)
return ret;

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1993, 1997, 1998, 1999 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -29,6 +29,7 @@
#include "libioP.h"
#include <string.h>
#include <wchar.h>
#include <stdio_ext.h>
#if 0
/* The following definitions are for exposition only.
@ -106,6 +107,11 @@ _IO_wstr_init_static (fp, ptr, size, pstart)
}
/* A null _allocate_buffer function flags the strfile as being static. */
(((_IO_strfile *) fp)->_s._allocate_buffer) = (_IO_alloc_type)0;
#ifdef _IO_MTSAFE_IO
/* We never have to lock this stream. */
__fsetlocking ((FILE *) fp, FSETLOCKING_BYCALLER);
#endif
}
void