2007-05-25 07:55:28 +08:00
|
|
|
/* Checking macros for fcntl functions.
|
2012-01-08 12:57:22 +08:00
|
|
|
Copyright (C) 2007, 2012 Free Software Foundation, Inc.
|
2007-05-25 07:55:28 +08:00
|
|
|
This file is part of the GNU C Library.
|
|
|
|
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2012-02-10 07:18:22 +08:00
|
|
|
License along with the GNU C Library; if not, see
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
2007-05-25 07:55:28 +08:00
|
|
|
|
|
|
|
#ifndef _FCNTL_H
|
|
|
|
# error "Never include <bits/fcntl2.h> directly; use <fcntl.h> instead."
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Check that calls to open and openat with O_CREAT set have an
|
|
|
|
appropriate third/fourth parameter. */
|
|
|
|
#ifndef __USE_FILE_OFFSET64
|
2012-01-08 12:57:22 +08:00
|
|
|
extern int __open_2 (const char *__path, int __oflag) __nonnull ((1));
|
|
|
|
extern int __REDIRECT (__open_alias, (const char *__path, int __oflag, ...),
|
* rt/Versions (librt): Export __mq_open_2@@GLIBC_2.7.
* rt/Makefile (headers): Add bits/mqueue2.h.
* rt/mqueue.h: Include bits/mqueue2.h if -D_FORTIFY_SOURCE=2,
optimizing with GCC and __va_arg_pack_len is defined.
* rt/bits/mqueue2.h: New file.
* rt/mq_open.c (__mq_open): Renamed from mq_open.
(mq_open): New strong_alias.
(__mq_open_2): New function.
* sysdeps/unix/sysv/linux/mq_open.c (__mq_open): Renamed from mq_open.
(mq_open): New strong_alias.
(__mq_open_2): New function.
* debug/Versions (libc): Export __fortify_fail@@GLIBC_PRIVATE.
* Versions.def (librt): Add GLIBC_2.7 version.
* debug/fortify_fail.c (__fortify_fail): Add libc_hidden_def.
* include/stdio.h (__fortify_fail): Add libc_hidden_proto.
* misc/sys/cdefs.h (__errordecl, __va_arg_pack_len): Define.
* io/fcntl.h: Include bits/fcntl2.h when __va_arg_pack_len
is defined rather than when not C++.
* io/bits/fcntl2.h (__open_alias, __open64_alias, __openat_alias,
__openat64_alias): New redirects.
(__open_too_many_args, __open_missing_mode, __open64_too_many_args,
__open64_missing_mode, __openat_too_many_args, __openat_missing_mode,
__openat64_too_many_args, __openat64_missing_mode): New __errordecls.
(open, open64, openat, openat64): Rewrite as __extern_always_inline
functions instead of function-like macros.
2007-09-16 06:35:27 +08:00
|
|
|
open) __nonnull ((1));
|
2007-05-25 07:55:28 +08:00
|
|
|
#else
|
2012-01-08 12:57:22 +08:00
|
|
|
extern int __REDIRECT (__open_2, (const char *__path, int __oflag),
|
2007-05-25 07:55:28 +08:00
|
|
|
__open64_2) __nonnull ((1));
|
2012-01-08 12:57:22 +08:00
|
|
|
extern int __REDIRECT (__open_alias, (const char *__path, int __oflag, ...),
|
* rt/Versions (librt): Export __mq_open_2@@GLIBC_2.7.
* rt/Makefile (headers): Add bits/mqueue2.h.
* rt/mqueue.h: Include bits/mqueue2.h if -D_FORTIFY_SOURCE=2,
optimizing with GCC and __va_arg_pack_len is defined.
* rt/bits/mqueue2.h: New file.
* rt/mq_open.c (__mq_open): Renamed from mq_open.
(mq_open): New strong_alias.
(__mq_open_2): New function.
* sysdeps/unix/sysv/linux/mq_open.c (__mq_open): Renamed from mq_open.
(mq_open): New strong_alias.
(__mq_open_2): New function.
* debug/Versions (libc): Export __fortify_fail@@GLIBC_PRIVATE.
* Versions.def (librt): Add GLIBC_2.7 version.
* debug/fortify_fail.c (__fortify_fail): Add libc_hidden_def.
* include/stdio.h (__fortify_fail): Add libc_hidden_proto.
* misc/sys/cdefs.h (__errordecl, __va_arg_pack_len): Define.
* io/fcntl.h: Include bits/fcntl2.h when __va_arg_pack_len
is defined rather than when not C++.
* io/bits/fcntl2.h (__open_alias, __open64_alias, __openat_alias,
__openat64_alias): New redirects.
(__open_too_many_args, __open_missing_mode, __open64_too_many_args,
__open64_missing_mode, __openat_too_many_args, __openat_missing_mode,
__openat64_too_many_args, __openat64_missing_mode): New __errordecls.
(open, open64, openat, openat64): Rewrite as __extern_always_inline
functions instead of function-like macros.
2007-09-16 06:35:27 +08:00
|
|
|
open64) __nonnull ((1));
|
2007-05-25 07:55:28 +08:00
|
|
|
#endif
|
* rt/Versions (librt): Export __mq_open_2@@GLIBC_2.7.
* rt/Makefile (headers): Add bits/mqueue2.h.
* rt/mqueue.h: Include bits/mqueue2.h if -D_FORTIFY_SOURCE=2,
optimizing with GCC and __va_arg_pack_len is defined.
* rt/bits/mqueue2.h: New file.
* rt/mq_open.c (__mq_open): Renamed from mq_open.
(mq_open): New strong_alias.
(__mq_open_2): New function.
* sysdeps/unix/sysv/linux/mq_open.c (__mq_open): Renamed from mq_open.
(mq_open): New strong_alias.
(__mq_open_2): New function.
* debug/Versions (libc): Export __fortify_fail@@GLIBC_PRIVATE.
* Versions.def (librt): Add GLIBC_2.7 version.
* debug/fortify_fail.c (__fortify_fail): Add libc_hidden_def.
* include/stdio.h (__fortify_fail): Add libc_hidden_proto.
* misc/sys/cdefs.h (__errordecl, __va_arg_pack_len): Define.
* io/fcntl.h: Include bits/fcntl2.h when __va_arg_pack_len
is defined rather than when not C++.
* io/bits/fcntl2.h (__open_alias, __open64_alias, __openat_alias,
__openat64_alias): New redirects.
(__open_too_many_args, __open_missing_mode, __open64_too_many_args,
__open64_missing_mode, __openat_too_many_args, __openat_missing_mode,
__openat64_too_many_args, __openat64_missing_mode): New __errordecls.
(open, open64, openat, openat64): Rewrite as __extern_always_inline
functions instead of function-like macros.
2007-09-16 06:35:27 +08:00
|
|
|
__errordecl (__open_too_many_args,
|
|
|
|
"open can be called either with 2 or 3 arguments, not more");
|
|
|
|
__errordecl (__open_missing_mode,
|
|
|
|
"open with O_CREAT in second argument needs 3 arguments");
|
2007-05-25 07:55:28 +08:00
|
|
|
|
2012-04-29 21:34:20 +08:00
|
|
|
__fortify_function int
|
2012-01-08 12:57:22 +08:00
|
|
|
open (const char *__path, int __oflag, ...)
|
* rt/Versions (librt): Export __mq_open_2@@GLIBC_2.7.
* rt/Makefile (headers): Add bits/mqueue2.h.
* rt/mqueue.h: Include bits/mqueue2.h if -D_FORTIFY_SOURCE=2,
optimizing with GCC and __va_arg_pack_len is defined.
* rt/bits/mqueue2.h: New file.
* rt/mq_open.c (__mq_open): Renamed from mq_open.
(mq_open): New strong_alias.
(__mq_open_2): New function.
* sysdeps/unix/sysv/linux/mq_open.c (__mq_open): Renamed from mq_open.
(mq_open): New strong_alias.
(__mq_open_2): New function.
* debug/Versions (libc): Export __fortify_fail@@GLIBC_PRIVATE.
* Versions.def (librt): Add GLIBC_2.7 version.
* debug/fortify_fail.c (__fortify_fail): Add libc_hidden_def.
* include/stdio.h (__fortify_fail): Add libc_hidden_proto.
* misc/sys/cdefs.h (__errordecl, __va_arg_pack_len): Define.
* io/fcntl.h: Include bits/fcntl2.h when __va_arg_pack_len
is defined rather than when not C++.
* io/bits/fcntl2.h (__open_alias, __open64_alias, __openat_alias,
__openat64_alias): New redirects.
(__open_too_many_args, __open_missing_mode, __open64_too_many_args,
__open64_missing_mode, __openat_too_many_args, __openat_missing_mode,
__openat64_too_many_args, __openat64_missing_mode): New __errordecls.
(open, open64, openat, openat64): Rewrite as __extern_always_inline
functions instead of function-like macros.
2007-09-16 06:35:27 +08:00
|
|
|
{
|
|
|
|
if (__va_arg_pack_len () > 1)
|
|
|
|
__open_too_many_args ();
|
|
|
|
|
|
|
|
if (__builtin_constant_p (__oflag))
|
|
|
|
{
|
|
|
|
if ((__oflag & O_CREAT) != 0 && __va_arg_pack_len () < 1)
|
|
|
|
{
|
|
|
|
__open_missing_mode ();
|
|
|
|
return __open_2 (__path, __oflag);
|
|
|
|
}
|
|
|
|
return __open_alias (__path, __oflag, __va_arg_pack ());
|
|
|
|
}
|
|
|
|
|
|
|
|
if (__va_arg_pack_len () < 1)
|
|
|
|
return __open_2 (__path, __oflag);
|
|
|
|
|
|
|
|
return __open_alias (__path, __oflag, __va_arg_pack ());
|
|
|
|
}
|
2007-05-25 07:55:28 +08:00
|
|
|
|
|
|
|
|
|
|
|
#ifdef __USE_LARGEFILE64
|
2012-01-08 12:57:22 +08:00
|
|
|
extern int __open64_2 (const char *__path, int __oflag) __nonnull ((1));
|
|
|
|
extern int __REDIRECT (__open64_alias, (const char *__path, int __oflag,
|
* rt/Versions (librt): Export __mq_open_2@@GLIBC_2.7.
* rt/Makefile (headers): Add bits/mqueue2.h.
* rt/mqueue.h: Include bits/mqueue2.h if -D_FORTIFY_SOURCE=2,
optimizing with GCC and __va_arg_pack_len is defined.
* rt/bits/mqueue2.h: New file.
* rt/mq_open.c (__mq_open): Renamed from mq_open.
(mq_open): New strong_alias.
(__mq_open_2): New function.
* sysdeps/unix/sysv/linux/mq_open.c (__mq_open): Renamed from mq_open.
(mq_open): New strong_alias.
(__mq_open_2): New function.
* debug/Versions (libc): Export __fortify_fail@@GLIBC_PRIVATE.
* Versions.def (librt): Add GLIBC_2.7 version.
* debug/fortify_fail.c (__fortify_fail): Add libc_hidden_def.
* include/stdio.h (__fortify_fail): Add libc_hidden_proto.
* misc/sys/cdefs.h (__errordecl, __va_arg_pack_len): Define.
* io/fcntl.h: Include bits/fcntl2.h when __va_arg_pack_len
is defined rather than when not C++.
* io/bits/fcntl2.h (__open_alias, __open64_alias, __openat_alias,
__openat64_alias): New redirects.
(__open_too_many_args, __open_missing_mode, __open64_too_many_args,
__open64_missing_mode, __openat_too_many_args, __openat_missing_mode,
__openat64_too_many_args, __openat64_missing_mode): New __errordecls.
(open, open64, openat, openat64): Rewrite as __extern_always_inline
functions instead of function-like macros.
2007-09-16 06:35:27 +08:00
|
|
|
...), open64) __nonnull ((1));
|
|
|
|
__errordecl (__open64_too_many_args,
|
|
|
|
"open64 can be called either with 2 or 3 arguments, not more");
|
|
|
|
__errordecl (__open64_missing_mode,
|
|
|
|
"open64 with O_CREAT in second argument needs 3 arguments");
|
|
|
|
|
2012-04-29 21:34:20 +08:00
|
|
|
__fortify_function int
|
2012-01-08 12:57:22 +08:00
|
|
|
open64 (const char *__path, int __oflag, ...)
|
* rt/Versions (librt): Export __mq_open_2@@GLIBC_2.7.
* rt/Makefile (headers): Add bits/mqueue2.h.
* rt/mqueue.h: Include bits/mqueue2.h if -D_FORTIFY_SOURCE=2,
optimizing with GCC and __va_arg_pack_len is defined.
* rt/bits/mqueue2.h: New file.
* rt/mq_open.c (__mq_open): Renamed from mq_open.
(mq_open): New strong_alias.
(__mq_open_2): New function.
* sysdeps/unix/sysv/linux/mq_open.c (__mq_open): Renamed from mq_open.
(mq_open): New strong_alias.
(__mq_open_2): New function.
* debug/Versions (libc): Export __fortify_fail@@GLIBC_PRIVATE.
* Versions.def (librt): Add GLIBC_2.7 version.
* debug/fortify_fail.c (__fortify_fail): Add libc_hidden_def.
* include/stdio.h (__fortify_fail): Add libc_hidden_proto.
* misc/sys/cdefs.h (__errordecl, __va_arg_pack_len): Define.
* io/fcntl.h: Include bits/fcntl2.h when __va_arg_pack_len
is defined rather than when not C++.
* io/bits/fcntl2.h (__open_alias, __open64_alias, __openat_alias,
__openat64_alias): New redirects.
(__open_too_many_args, __open_missing_mode, __open64_too_many_args,
__open64_missing_mode, __openat_too_many_args, __openat_missing_mode,
__openat64_too_many_args, __openat64_missing_mode): New __errordecls.
(open, open64, openat, openat64): Rewrite as __extern_always_inline
functions instead of function-like macros.
2007-09-16 06:35:27 +08:00
|
|
|
{
|
|
|
|
if (__va_arg_pack_len () > 1)
|
|
|
|
__open64_too_many_args ();
|
2007-05-25 07:55:28 +08:00
|
|
|
|
* rt/Versions (librt): Export __mq_open_2@@GLIBC_2.7.
* rt/Makefile (headers): Add bits/mqueue2.h.
* rt/mqueue.h: Include bits/mqueue2.h if -D_FORTIFY_SOURCE=2,
optimizing with GCC and __va_arg_pack_len is defined.
* rt/bits/mqueue2.h: New file.
* rt/mq_open.c (__mq_open): Renamed from mq_open.
(mq_open): New strong_alias.
(__mq_open_2): New function.
* sysdeps/unix/sysv/linux/mq_open.c (__mq_open): Renamed from mq_open.
(mq_open): New strong_alias.
(__mq_open_2): New function.
* debug/Versions (libc): Export __fortify_fail@@GLIBC_PRIVATE.
* Versions.def (librt): Add GLIBC_2.7 version.
* debug/fortify_fail.c (__fortify_fail): Add libc_hidden_def.
* include/stdio.h (__fortify_fail): Add libc_hidden_proto.
* misc/sys/cdefs.h (__errordecl, __va_arg_pack_len): Define.
* io/fcntl.h: Include bits/fcntl2.h when __va_arg_pack_len
is defined rather than when not C++.
* io/bits/fcntl2.h (__open_alias, __open64_alias, __openat_alias,
__openat64_alias): New redirects.
(__open_too_many_args, __open_missing_mode, __open64_too_many_args,
__open64_missing_mode, __openat_too_many_args, __openat_missing_mode,
__openat64_too_many_args, __openat64_missing_mode): New __errordecls.
(open, open64, openat, openat64): Rewrite as __extern_always_inline
functions instead of function-like macros.
2007-09-16 06:35:27 +08:00
|
|
|
if (__builtin_constant_p (__oflag))
|
|
|
|
{
|
|
|
|
if ((__oflag & O_CREAT) != 0 && __va_arg_pack_len () < 1)
|
|
|
|
{
|
|
|
|
__open64_missing_mode ();
|
|
|
|
return __open64_2 (__path, __oflag);
|
|
|
|
}
|
|
|
|
return __open64_alias (__path, __oflag, __va_arg_pack ());
|
|
|
|
}
|
|
|
|
|
|
|
|
if (__va_arg_pack_len () < 1)
|
|
|
|
return __open64_2 (__path, __oflag);
|
|
|
|
|
|
|
|
return __open64_alias (__path, __oflag, __va_arg_pack ());
|
|
|
|
}
|
2007-05-25 07:55:28 +08:00
|
|
|
#endif
|
|
|
|
|
* rt/Versions (librt): Export __mq_open_2@@GLIBC_2.7.
* rt/Makefile (headers): Add bits/mqueue2.h.
* rt/mqueue.h: Include bits/mqueue2.h if -D_FORTIFY_SOURCE=2,
optimizing with GCC and __va_arg_pack_len is defined.
* rt/bits/mqueue2.h: New file.
* rt/mq_open.c (__mq_open): Renamed from mq_open.
(mq_open): New strong_alias.
(__mq_open_2): New function.
* sysdeps/unix/sysv/linux/mq_open.c (__mq_open): Renamed from mq_open.
(mq_open): New strong_alias.
(__mq_open_2): New function.
* debug/Versions (libc): Export __fortify_fail@@GLIBC_PRIVATE.
* Versions.def (librt): Add GLIBC_2.7 version.
* debug/fortify_fail.c (__fortify_fail): Add libc_hidden_def.
* include/stdio.h (__fortify_fail): Add libc_hidden_proto.
* misc/sys/cdefs.h (__errordecl, __va_arg_pack_len): Define.
* io/fcntl.h: Include bits/fcntl2.h when __va_arg_pack_len
is defined rather than when not C++.
* io/bits/fcntl2.h (__open_alias, __open64_alias, __openat_alias,
__openat64_alias): New redirects.
(__open_too_many_args, __open_missing_mode, __open64_too_many_args,
__open64_missing_mode, __openat_too_many_args, __openat_missing_mode,
__openat64_too_many_args, __openat64_missing_mode): New __errordecls.
(open, open64, openat, openat64): Rewrite as __extern_always_inline
functions instead of function-like macros.
2007-09-16 06:35:27 +08:00
|
|
|
|
2007-05-25 07:55:28 +08:00
|
|
|
#ifdef __USE_ATFILE
|
|
|
|
# ifndef __USE_FILE_OFFSET64
|
2012-01-08 12:57:22 +08:00
|
|
|
extern int __openat_2 (int __fd, const char *__path, int __oflag)
|
2007-05-25 22:41:55 +08:00
|
|
|
__nonnull ((2));
|
2012-01-08 12:57:22 +08:00
|
|
|
extern int __REDIRECT (__openat_alias, (int __fd, const char *__path,
|
* rt/Versions (librt): Export __mq_open_2@@GLIBC_2.7.
* rt/Makefile (headers): Add bits/mqueue2.h.
* rt/mqueue.h: Include bits/mqueue2.h if -D_FORTIFY_SOURCE=2,
optimizing with GCC and __va_arg_pack_len is defined.
* rt/bits/mqueue2.h: New file.
* rt/mq_open.c (__mq_open): Renamed from mq_open.
(mq_open): New strong_alias.
(__mq_open_2): New function.
* sysdeps/unix/sysv/linux/mq_open.c (__mq_open): Renamed from mq_open.
(mq_open): New strong_alias.
(__mq_open_2): New function.
* debug/Versions (libc): Export __fortify_fail@@GLIBC_PRIVATE.
* Versions.def (librt): Add GLIBC_2.7 version.
* debug/fortify_fail.c (__fortify_fail): Add libc_hidden_def.
* include/stdio.h (__fortify_fail): Add libc_hidden_proto.
* misc/sys/cdefs.h (__errordecl, __va_arg_pack_len): Define.
* io/fcntl.h: Include bits/fcntl2.h when __va_arg_pack_len
is defined rather than when not C++.
* io/bits/fcntl2.h (__open_alias, __open64_alias, __openat_alias,
__openat64_alias): New redirects.
(__open_too_many_args, __open_missing_mode, __open64_too_many_args,
__open64_missing_mode, __openat_too_many_args, __openat_missing_mode,
__openat64_too_many_args, __openat64_missing_mode): New __errordecls.
(open, open64, openat, openat64): Rewrite as __extern_always_inline
functions instead of function-like macros.
2007-09-16 06:35:27 +08:00
|
|
|
int __oflag, ...), openat)
|
|
|
|
__nonnull ((2));
|
2007-05-25 07:55:28 +08:00
|
|
|
# else
|
2012-01-08 12:57:22 +08:00
|
|
|
extern int __REDIRECT (__openat_2, (int __fd, const char *__path,
|
2007-05-25 07:55:28 +08:00
|
|
|
int __oflag), __openat64_2)
|
2007-05-25 22:41:55 +08:00
|
|
|
__nonnull ((2));
|
2012-01-08 12:57:22 +08:00
|
|
|
extern int __REDIRECT (__openat_alias, (int __fd, const char *__path,
|
* rt/Versions (librt): Export __mq_open_2@@GLIBC_2.7.
* rt/Makefile (headers): Add bits/mqueue2.h.
* rt/mqueue.h: Include bits/mqueue2.h if -D_FORTIFY_SOURCE=2,
optimizing with GCC and __va_arg_pack_len is defined.
* rt/bits/mqueue2.h: New file.
* rt/mq_open.c (__mq_open): Renamed from mq_open.
(mq_open): New strong_alias.
(__mq_open_2): New function.
* sysdeps/unix/sysv/linux/mq_open.c (__mq_open): Renamed from mq_open.
(mq_open): New strong_alias.
(__mq_open_2): New function.
* debug/Versions (libc): Export __fortify_fail@@GLIBC_PRIVATE.
* Versions.def (librt): Add GLIBC_2.7 version.
* debug/fortify_fail.c (__fortify_fail): Add libc_hidden_def.
* include/stdio.h (__fortify_fail): Add libc_hidden_proto.
* misc/sys/cdefs.h (__errordecl, __va_arg_pack_len): Define.
* io/fcntl.h: Include bits/fcntl2.h when __va_arg_pack_len
is defined rather than when not C++.
* io/bits/fcntl2.h (__open_alias, __open64_alias, __openat_alias,
__openat64_alias): New redirects.
(__open_too_many_args, __open_missing_mode, __open64_too_many_args,
__open64_missing_mode, __openat_too_many_args, __openat_missing_mode,
__openat64_too_many_args, __openat64_missing_mode): New __errordecls.
(open, open64, openat, openat64): Rewrite as __extern_always_inline
functions instead of function-like macros.
2007-09-16 06:35:27 +08:00
|
|
|
int __oflag, ...), openat64)
|
|
|
|
__nonnull ((2));
|
2007-05-25 07:55:28 +08:00
|
|
|
# endif
|
* rt/Versions (librt): Export __mq_open_2@@GLIBC_2.7.
* rt/Makefile (headers): Add bits/mqueue2.h.
* rt/mqueue.h: Include bits/mqueue2.h if -D_FORTIFY_SOURCE=2,
optimizing with GCC and __va_arg_pack_len is defined.
* rt/bits/mqueue2.h: New file.
* rt/mq_open.c (__mq_open): Renamed from mq_open.
(mq_open): New strong_alias.
(__mq_open_2): New function.
* sysdeps/unix/sysv/linux/mq_open.c (__mq_open): Renamed from mq_open.
(mq_open): New strong_alias.
(__mq_open_2): New function.
* debug/Versions (libc): Export __fortify_fail@@GLIBC_PRIVATE.
* Versions.def (librt): Add GLIBC_2.7 version.
* debug/fortify_fail.c (__fortify_fail): Add libc_hidden_def.
* include/stdio.h (__fortify_fail): Add libc_hidden_proto.
* misc/sys/cdefs.h (__errordecl, __va_arg_pack_len): Define.
* io/fcntl.h: Include bits/fcntl2.h when __va_arg_pack_len
is defined rather than when not C++.
* io/bits/fcntl2.h (__open_alias, __open64_alias, __openat_alias,
__openat64_alias): New redirects.
(__open_too_many_args, __open_missing_mode, __open64_too_many_args,
__open64_missing_mode, __openat_too_many_args, __openat_missing_mode,
__openat64_too_many_args, __openat64_missing_mode): New __errordecls.
(open, open64, openat, openat64): Rewrite as __extern_always_inline
functions instead of function-like macros.
2007-09-16 06:35:27 +08:00
|
|
|
__errordecl (__openat_too_many_args,
|
|
|
|
"openat can be called either with 3 or 4 arguments, not more");
|
|
|
|
__errordecl (__openat_missing_mode,
|
|
|
|
"openat with O_CREAT in third argument needs 4 arguments");
|
|
|
|
|
2012-04-29 21:34:20 +08:00
|
|
|
__fortify_function int
|
2012-01-08 12:57:22 +08:00
|
|
|
openat (int __fd, const char *__path, int __oflag, ...)
|
* rt/Versions (librt): Export __mq_open_2@@GLIBC_2.7.
* rt/Makefile (headers): Add bits/mqueue2.h.
* rt/mqueue.h: Include bits/mqueue2.h if -D_FORTIFY_SOURCE=2,
optimizing with GCC and __va_arg_pack_len is defined.
* rt/bits/mqueue2.h: New file.
* rt/mq_open.c (__mq_open): Renamed from mq_open.
(mq_open): New strong_alias.
(__mq_open_2): New function.
* sysdeps/unix/sysv/linux/mq_open.c (__mq_open): Renamed from mq_open.
(mq_open): New strong_alias.
(__mq_open_2): New function.
* debug/Versions (libc): Export __fortify_fail@@GLIBC_PRIVATE.
* Versions.def (librt): Add GLIBC_2.7 version.
* debug/fortify_fail.c (__fortify_fail): Add libc_hidden_def.
* include/stdio.h (__fortify_fail): Add libc_hidden_proto.
* misc/sys/cdefs.h (__errordecl, __va_arg_pack_len): Define.
* io/fcntl.h: Include bits/fcntl2.h when __va_arg_pack_len
is defined rather than when not C++.
* io/bits/fcntl2.h (__open_alias, __open64_alias, __openat_alias,
__openat64_alias): New redirects.
(__open_too_many_args, __open_missing_mode, __open64_too_many_args,
__open64_missing_mode, __openat_too_many_args, __openat_missing_mode,
__openat64_too_many_args, __openat64_missing_mode): New __errordecls.
(open, open64, openat, openat64): Rewrite as __extern_always_inline
functions instead of function-like macros.
2007-09-16 06:35:27 +08:00
|
|
|
{
|
|
|
|
if (__va_arg_pack_len () > 1)
|
|
|
|
__openat_too_many_args ();
|
|
|
|
|
|
|
|
if (__builtin_constant_p (__oflag))
|
|
|
|
{
|
|
|
|
if ((__oflag & O_CREAT) != 0 && __va_arg_pack_len () < 1)
|
|
|
|
{
|
|
|
|
__openat_missing_mode ();
|
|
|
|
return __openat_2 (__fd, __path, __oflag);
|
|
|
|
}
|
|
|
|
return __openat_alias (__fd, __path, __oflag, __va_arg_pack ());
|
|
|
|
}
|
|
|
|
|
|
|
|
if (__va_arg_pack_len () < 1)
|
|
|
|
return __openat_2 (__fd, __path, __oflag);
|
2007-05-25 07:55:28 +08:00
|
|
|
|
* rt/Versions (librt): Export __mq_open_2@@GLIBC_2.7.
* rt/Makefile (headers): Add bits/mqueue2.h.
* rt/mqueue.h: Include bits/mqueue2.h if -D_FORTIFY_SOURCE=2,
optimizing with GCC and __va_arg_pack_len is defined.
* rt/bits/mqueue2.h: New file.
* rt/mq_open.c (__mq_open): Renamed from mq_open.
(mq_open): New strong_alias.
(__mq_open_2): New function.
* sysdeps/unix/sysv/linux/mq_open.c (__mq_open): Renamed from mq_open.
(mq_open): New strong_alias.
(__mq_open_2): New function.
* debug/Versions (libc): Export __fortify_fail@@GLIBC_PRIVATE.
* Versions.def (librt): Add GLIBC_2.7 version.
* debug/fortify_fail.c (__fortify_fail): Add libc_hidden_def.
* include/stdio.h (__fortify_fail): Add libc_hidden_proto.
* misc/sys/cdefs.h (__errordecl, __va_arg_pack_len): Define.
* io/fcntl.h: Include bits/fcntl2.h when __va_arg_pack_len
is defined rather than when not C++.
* io/bits/fcntl2.h (__open_alias, __open64_alias, __openat_alias,
__openat64_alias): New redirects.
(__open_too_many_args, __open_missing_mode, __open64_too_many_args,
__open64_missing_mode, __openat_too_many_args, __openat_missing_mode,
__openat64_too_many_args, __openat64_missing_mode): New __errordecls.
(open, open64, openat, openat64): Rewrite as __extern_always_inline
functions instead of function-like macros.
2007-09-16 06:35:27 +08:00
|
|
|
return __openat_alias (__fd, __path, __oflag, __va_arg_pack ());
|
|
|
|
}
|
2007-05-25 07:55:28 +08:00
|
|
|
|
|
|
|
|
|
|
|
# ifdef __USE_LARGEFILE64
|
2012-01-08 12:57:22 +08:00
|
|
|
extern int __openat64_2 (int __fd, const char *__path, int __oflag)
|
2007-05-25 22:41:55 +08:00
|
|
|
__nonnull ((2));
|
2012-01-08 12:57:22 +08:00
|
|
|
extern int __REDIRECT (__openat64_alias, (int __fd, const char *__path,
|
* rt/Versions (librt): Export __mq_open_2@@GLIBC_2.7.
* rt/Makefile (headers): Add bits/mqueue2.h.
* rt/mqueue.h: Include bits/mqueue2.h if -D_FORTIFY_SOURCE=2,
optimizing with GCC and __va_arg_pack_len is defined.
* rt/bits/mqueue2.h: New file.
* rt/mq_open.c (__mq_open): Renamed from mq_open.
(mq_open): New strong_alias.
(__mq_open_2): New function.
* sysdeps/unix/sysv/linux/mq_open.c (__mq_open): Renamed from mq_open.
(mq_open): New strong_alias.
(__mq_open_2): New function.
* debug/Versions (libc): Export __fortify_fail@@GLIBC_PRIVATE.
* Versions.def (librt): Add GLIBC_2.7 version.
* debug/fortify_fail.c (__fortify_fail): Add libc_hidden_def.
* include/stdio.h (__fortify_fail): Add libc_hidden_proto.
* misc/sys/cdefs.h (__errordecl, __va_arg_pack_len): Define.
* io/fcntl.h: Include bits/fcntl2.h when __va_arg_pack_len
is defined rather than when not C++.
* io/bits/fcntl2.h (__open_alias, __open64_alias, __openat_alias,
__openat64_alias): New redirects.
(__open_too_many_args, __open_missing_mode, __open64_too_many_args,
__open64_missing_mode, __openat_too_many_args, __openat_missing_mode,
__openat64_too_many_args, __openat64_missing_mode): New __errordecls.
(open, open64, openat, openat64): Rewrite as __extern_always_inline
functions instead of function-like macros.
2007-09-16 06:35:27 +08:00
|
|
|
int __oflag, ...), openat64)
|
|
|
|
__nonnull ((2));
|
|
|
|
__errordecl (__openat64_too_many_args,
|
|
|
|
"openat64 can be called either with 3 or 4 arguments, not more");
|
|
|
|
__errordecl (__openat64_missing_mode,
|
|
|
|
"openat64 with O_CREAT in third argument needs 4 arguments");
|
|
|
|
|
2012-04-29 21:34:20 +08:00
|
|
|
__fortify_function int
|
2012-01-08 12:57:22 +08:00
|
|
|
openat64 (int __fd, const char *__path, int __oflag, ...)
|
* rt/Versions (librt): Export __mq_open_2@@GLIBC_2.7.
* rt/Makefile (headers): Add bits/mqueue2.h.
* rt/mqueue.h: Include bits/mqueue2.h if -D_FORTIFY_SOURCE=2,
optimizing with GCC and __va_arg_pack_len is defined.
* rt/bits/mqueue2.h: New file.
* rt/mq_open.c (__mq_open): Renamed from mq_open.
(mq_open): New strong_alias.
(__mq_open_2): New function.
* sysdeps/unix/sysv/linux/mq_open.c (__mq_open): Renamed from mq_open.
(mq_open): New strong_alias.
(__mq_open_2): New function.
* debug/Versions (libc): Export __fortify_fail@@GLIBC_PRIVATE.
* Versions.def (librt): Add GLIBC_2.7 version.
* debug/fortify_fail.c (__fortify_fail): Add libc_hidden_def.
* include/stdio.h (__fortify_fail): Add libc_hidden_proto.
* misc/sys/cdefs.h (__errordecl, __va_arg_pack_len): Define.
* io/fcntl.h: Include bits/fcntl2.h when __va_arg_pack_len
is defined rather than when not C++.
* io/bits/fcntl2.h (__open_alias, __open64_alias, __openat_alias,
__openat64_alias): New redirects.
(__open_too_many_args, __open_missing_mode, __open64_too_many_args,
__open64_missing_mode, __openat_too_many_args, __openat_missing_mode,
__openat64_too_many_args, __openat64_missing_mode): New __errordecls.
(open, open64, openat, openat64): Rewrite as __extern_always_inline
functions instead of function-like macros.
2007-09-16 06:35:27 +08:00
|
|
|
{
|
|
|
|
if (__va_arg_pack_len () > 1)
|
|
|
|
__openat64_too_many_args ();
|
|
|
|
|
|
|
|
if (__builtin_constant_p (__oflag))
|
|
|
|
{
|
|
|
|
if ((__oflag & O_CREAT) != 0 && __va_arg_pack_len () < 1)
|
|
|
|
{
|
|
|
|
__openat64_missing_mode ();
|
|
|
|
return __openat64_2 (__fd, __path, __oflag);
|
|
|
|
}
|
|
|
|
return __openat64_alias (__fd, __path, __oflag, __va_arg_pack ());
|
|
|
|
}
|
|
|
|
|
|
|
|
if (__va_arg_pack_len () < 1)
|
|
|
|
return __openat64_2 (__fd, __path, __oflag);
|
2007-05-25 07:55:28 +08:00
|
|
|
|
* rt/Versions (librt): Export __mq_open_2@@GLIBC_2.7.
* rt/Makefile (headers): Add bits/mqueue2.h.
* rt/mqueue.h: Include bits/mqueue2.h if -D_FORTIFY_SOURCE=2,
optimizing with GCC and __va_arg_pack_len is defined.
* rt/bits/mqueue2.h: New file.
* rt/mq_open.c (__mq_open): Renamed from mq_open.
(mq_open): New strong_alias.
(__mq_open_2): New function.
* sysdeps/unix/sysv/linux/mq_open.c (__mq_open): Renamed from mq_open.
(mq_open): New strong_alias.
(__mq_open_2): New function.
* debug/Versions (libc): Export __fortify_fail@@GLIBC_PRIVATE.
* Versions.def (librt): Add GLIBC_2.7 version.
* debug/fortify_fail.c (__fortify_fail): Add libc_hidden_def.
* include/stdio.h (__fortify_fail): Add libc_hidden_proto.
* misc/sys/cdefs.h (__errordecl, __va_arg_pack_len): Define.
* io/fcntl.h: Include bits/fcntl2.h when __va_arg_pack_len
is defined rather than when not C++.
* io/bits/fcntl2.h (__open_alias, __open64_alias, __openat_alias,
__openat64_alias): New redirects.
(__open_too_many_args, __open_missing_mode, __open64_too_many_args,
__open64_missing_mode, __openat_too_many_args, __openat_missing_mode,
__openat64_too_many_args, __openat64_missing_mode): New __errordecls.
(open, open64, openat, openat64): Rewrite as __extern_always_inline
functions instead of function-like macros.
2007-09-16 06:35:27 +08:00
|
|
|
return __openat64_alias (__fd, __path, __oflag, __va_arg_pack ());
|
|
|
|
}
|
2007-05-25 07:55:28 +08:00
|
|
|
# endif
|
|
|
|
#endif
|