1*3eb244d8Sjoerg /* $NetBSD: stdio.h,v 1.5 2011/07/17 20:54:34 joerg Exp $ */ 22368dc66Stls 32368dc66Stls /*- 42368dc66Stls * Copyright (c) 2006 The NetBSD Foundation, Inc. 52368dc66Stls * All rights reserved. 62368dc66Stls * 72368dc66Stls * This code is derived from software contributed to The NetBSD Foundation 82368dc66Stls * by Christos Zoulas. 92368dc66Stls * 102368dc66Stls * Redistribution and use in source and binary forms, with or without 112368dc66Stls * modification, are permitted provided that the following conditions 122368dc66Stls * are met: 132368dc66Stls * 1. Redistributions of source code must retain the above copyright 142368dc66Stls * notice, this list of conditions and the following disclaimer. 152368dc66Stls * 2. Redistributions in binary form must reproduce the above copyright 162368dc66Stls * notice, this list of conditions and the following disclaimer in the 172368dc66Stls * documentation and/or other materials provided with the distribution. 182368dc66Stls * 192368dc66Stls * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 202368dc66Stls * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 212368dc66Stls * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 222368dc66Stls * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 232368dc66Stls * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 242368dc66Stls * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 252368dc66Stls * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 262368dc66Stls * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 272368dc66Stls * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 282368dc66Stls * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 292368dc66Stls * POSSIBILITY OF SUCH DAMAGE. 302368dc66Stls */ 312368dc66Stls #ifndef _SSP_STDIO_H_ 322368dc66Stls #define _SSP_STDIO_H_ 332368dc66Stls 34dc99372bStls #include <ssp/ssp.h> 352368dc66Stls 362368dc66Stls __BEGIN_DECLS 372368dc66Stls int __sprintf_chk(char *__restrict, int, size_t, const char *__restrict, ...) 388a601553Sjoerg __printflike(4, 5); 392368dc66Stls int __vsprintf_chk(char *__restrict, int, size_t, const char *__restrict, 40*3eb244d8Sjoerg __va_list) 418a601553Sjoerg __printflike(4, 0); 422368dc66Stls int __snprintf_chk(char *__restrict, size_t, int, size_t, 438a601553Sjoerg const char *__restrict, ...) 448a601553Sjoerg __printflike(5, 6); 452368dc66Stls int __vsnprintf_chk(char *__restrict, size_t, int, size_t, 46*3eb244d8Sjoerg const char *__restrict, __va_list) 478a601553Sjoerg __printflike(5, 0); 482368dc66Stls char *__gets_chk(char *, size_t); 492368dc66Stls char *__fgets_chk(char *, int, size_t, FILE *); 502368dc66Stls __END_DECLS 512368dc66Stls 522368dc66Stls #if __SSP_FORTIFY_LEVEL > 0 532368dc66Stls 542368dc66Stls 552368dc66Stls #define sprintf(str, ...) \ 562368dc66Stls __builtin___sprintf_chk(str, 0, __ssp_bos(str), __VA_ARGS__) 572368dc66Stls 582368dc66Stls #define vsprintf(str, fmt, ap) \ 592368dc66Stls __builtin___vsprintf_chk(str, 0, __ssp_bos(str), fmt, ap) 602368dc66Stls 612368dc66Stls #define snprintf(str, len, ...) \ 622368dc66Stls __builtin___snprintf_chk(str, len, 0, __ssp_bos(str), __VA_ARGS__) 632368dc66Stls 642368dc66Stls #define vsnprintf(str, len, fmt, ap) \ 652368dc66Stls __builtin___vsnprintf_chk(str, len, 0, __ssp_bos(str), fmt, ap) 662368dc66Stls 672368dc66Stls #define gets(str) \ 682368dc66Stls __gets_chk(str, __ssp_bos(str)) 692368dc66Stls 702368dc66Stls #define fgets(str, len, fp) \ 712368dc66Stls __fgets_chk(str, len, __ssp_bos(str), fp) 722368dc66Stls #endif /* __SSP_FORTIFY_LEVEL > 0 */ 732368dc66Stls 742368dc66Stls #endif /* _SSP_STDIO_H_ */ 75