aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1995-11-20 03:48:11 +0000
committerRoland McGrath <roland@gnu.org>1995-11-20 03:48:11 +0000
commit96aa2d94a2355cdc55c96e808d14a0e7f2ebe77d (patch)
treef7c87e6742af0707b858a1387ca85b679aa8d13e /sysdeps
parenta5a81fecc7194d050066265a15b1ba8bc3abc627 (diff)
downloadglibc-96aa2d94a2355cdc55c96e808d14a0e7f2ebe77d.zip
glibc-96aa2d94a2355cdc55c96e808d14a0e7f2ebe77d.tar.gz
glibc-96aa2d94a2355cdc55c96e808d14a0e7f2ebe77d.tar.bz2
Sat Nov 18 16:46:01 1995 Ulrich Drepper <drepper@gnu.ai.mit.edu>
* libio/Makefile, libio/cleanup.c, libio/clearerr.c, libio/feof.c, libio/ferror.c, libio/fgetc.c, libio/filedoalloc.c, libio/fileno.c, libio/fileops.c, libio/fputc.c, libio/freopen.c, libio/fseek.c, libio/genops.c, libio/getc.c, libio/getchar.c, libio/iofclose.c, libio/iofdopen.c, libio/iofflush.c, libio/iofgetpos.c, libio/iofgets.c, libio/iofopen.c, libio/iofprintf.c, libio/iofputs.c, libio/iofread.c, libio/iofscanf.c, libio/iofsetpos.c, libio/ioftell.c, libio/iofwrite.c, libio/iogetdelim.c, libio/iogetline.c, libio/iogets.c, libio/iolibio.h, libio/iopadn.c, libio/ioprims.c, libio/ioputs.c, libio/ioseekoff.c, libio/ioseekpos.c, libio/iosetbuffer.c, libio/iosetvbuf.c, libio/iosprintf.c, libio/ioungetc.c, libio/iovsprintf.c, libio/iovsscanf.c, libio/libio.h, libio/libioP.h, libio/putc.c, libio/putchar.c, libio/rewind.c, libio/setbuf.c, libio/setlinebuf.c, libio/stdfiles.c, libio/stdio.c, libio/stdio.h, libio/strfile.h, libio/strops.c, libio/vasprintf.c, libio/vscanf.c, libio/vsnprintf.c: New files. Slightly modified version from Linux libc. * libio/memstream.c, libio/vdprintf.c: New files for functions not (yet) part of GNU libio. * libio/iofopncook.c: Implementation of `fopencookie', mainly written by Per Bothner. * stdio-common/getline.c: Adapted to libio. * stdio-common/snprintf.c: Adapted to libio. * stdio-common/vfprintf.c: Adapted to libio. * stdio-common/vfscanf.c: Adapted to libio. * sysdeps/posix/tempname.c: Adapted to libio.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/posix/tempname.c41
-rw-r--r--sysdeps/unix/sysv/linux/configure3
2 files changed, 44 insertions, 0 deletions
diff --git a/sysdeps/posix/tempname.c b/sysdeps/posix/tempname.c
index f2da66a..c70a6e8 100644
--- a/sysdeps/posix/tempname.c
+++ b/sysdeps/posix/tempname.c
@@ -27,6 +27,11 @@ Cambridge, MA 02139, USA. */
#include <fcntl.h>
#include <unistd.h>
+#ifdef USE_IN_LIBIO
+# include "libioP.h"
+# include <libio.h>
+#endif
+
/* Return nonzero if DIR is an existent directory. */
static int
DEFUN(diraccess, (dir), CONST char *dir)
@@ -169,6 +174,41 @@ DEFUN(__stdio_gen_tempname, (dir, pfx, dir_search, lenptr, streamptr),
{
/* We got a new file that did not previously exist.
Create a stream for it. */
+#ifdef USE_IN_LIBIO
+ int save;
+ struct _IO_FILE_plus *fp;
+
+ fp = (struct _IO_FILE_plus *)
+ malloc(sizeof (struct _IO_FILE_plus));
+ if (fp == NULL)
+ {
+ /* We lost trying to create a stream (out of memory?).
+ Nothing to do but remove the file, close the descriptor,
+ and return failure. */
+ save = errno;
+ lose:
+ (void) remove (buf);
+ (void) __close (fd);
+ errno = save;
+ return NULL;
+ }
+ _IO_init (&fp->file, 0);
+ _IO_JUMPS (&fp->file) = &_IO_file_jumps;
+ _IO_file_init (&fp->file);
+# if !_IO_UNIFIED_JUMPTABLES
+ fp->vtable = NULL;
+# endif
+ if (_IO_file_attach (&fp->file, fd) == NULL)
+ {
+ save = errno;
+ free (fp);
+ goto lose;
+ }
+ fp->file._flags &= ~_IO_DELETE_DONT_CLOSE;
+ fp->file._IO_file_flags = 0;
+
+ *streamptr = (FILE *) fp;
+#else
*streamptr = __newstream ();
if (*streamptr == NULL)
{
@@ -185,6 +225,7 @@ DEFUN(__stdio_gen_tempname, (dir, pfx, dir_search, lenptr, streamptr),
(*streamptr)->__mode.__write = 1;
(*streamptr)->__mode.__read = 1;
(*streamptr)->__mode.__binary = 1;
+#endif
}
else
continue;
diff --git a/sysdeps/unix/sysv/linux/configure b/sysdeps/unix/sysv/linux/configure
new file mode 100644
index 0000000..63693e0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/configure
@@ -0,0 +1,3 @@
+# On Linux, the default is to use libio instead of stdio.
+
+test $stdio = default && stdio=libio