Update.
[glibc.git] / libio / iofopen64.c
blobd7f97478f68a6c8c7a4a31c294ac9e7d067a6303
1 /* Copyright (C) 1993, 1997, 1999, 2000 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 02111-1307 USA.
19 As a special exception, if you link the code in this file with
20 files compiled with a GNU compiler to produce an executable,
21 that does not cause the resulting executable to be covered by
22 the GNU Lesser General Public License. This exception does not
23 however invalidate any other reasons why the executable file
24 might be covered by the GNU Lesser General Public License.
25 This exception applies to code released by its copyright holders
26 in files containing the exception. */
28 #include "libioP.h"
29 #ifdef __STDC__
30 #include <stdlib.h>
31 #endif
33 _IO_FILE *
34 _IO_fopen64 (filename, mode)
35 const char *filename;
36 const char *mode;
38 #ifdef _G_OPEN64
39 struct locked_FILE
41 struct _IO_FILE_plus fp;
42 #ifdef _IO_MTSAFE_IO
43 _IO_lock_t lock;
44 #endif
45 struct _IO_wide_data wd;
46 } *new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
48 if (new_f == NULL)
49 return NULL;
50 #ifdef _IO_MTSAFE_IO
51 new_f->fp.file._lock = &new_f->lock;
52 #endif
53 _IO_no_init (&new_f->fp.file, 0, 0, &new_f->wd, &_IO_wfile_jumps);
54 _IO_JUMPS (&new_f->fp) = &_IO_file_jumps;
55 _IO_file_init (&new_f->fp);
56 #if !_IO_UNIFIED_JUMPTABLES
57 new_f->fp.vtable = NULL;
58 #endif
59 if (_IO_file_fopen ((_IO_FILE *) new_f, filename, mode, 0) != NULL)
60 return (_IO_FILE *) &new_f->fp;
61 _IO_un_link (&new_f->fp);
62 free (new_f);
63 return NULL;
64 #else
65 __set_errno (ENOSYS);
66 return NULL;
67 #endif
70 #ifdef weak_alias
71 weak_alias (_IO_fopen64, fopen64)
72 #endif