10e9a2605SKonstantin Belousov /*- 2*4d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause 3e6209940SPedro F. Giffuni * 40e9a2605SKonstantin Belousov * Copyright 2011 Konstantin Belousov <kib@FreeBSD.org>. 50e9a2605SKonstantin Belousov * All rights reserved. 60e9a2605SKonstantin Belousov * 70e9a2605SKonstantin Belousov * Redistribution and use in source and binary forms, with or without 80e9a2605SKonstantin Belousov * modification, are permitted provided that the following conditions 90e9a2605SKonstantin Belousov * are met: 100e9a2605SKonstantin Belousov * 1. Redistributions of source code must retain the above copyright 110e9a2605SKonstantin Belousov * notice, this list of conditions and the following disclaimer. 120e9a2605SKonstantin Belousov * 2. Redistributions in binary form must reproduce the above copyright 130e9a2605SKonstantin Belousov * notice, this list of conditions and the following disclaimer in the 140e9a2605SKonstantin Belousov * documentation and/or other materials provided with the distribution. 150e9a2605SKonstantin Belousov * 160e9a2605SKonstantin Belousov * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 170e9a2605SKonstantin Belousov * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 180e9a2605SKonstantin Belousov * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 190e9a2605SKonstantin Belousov * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 200e9a2605SKonstantin Belousov * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 210e9a2605SKonstantin Belousov * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 220e9a2605SKonstantin Belousov * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 230e9a2605SKonstantin Belousov * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 240e9a2605SKonstantin Belousov * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 250e9a2605SKonstantin Belousov * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 260e9a2605SKonstantin Belousov */ 270e9a2605SKonstantin Belousov 280e9a2605SKonstantin Belousov #ifndef RTLD_PRINTF_H 290e9a2605SKonstantin Belousov #define RTLD_PRINTF_H 1 300e9a2605SKonstantin Belousov 310e9a2605SKonstantin Belousov #include <sys/cdefs.h> 32e69dc862SAlex Richardson #include <stdarg.h> 330e9a2605SKonstantin Belousov #include <unistd.h> 340e9a2605SKonstantin Belousov 3502d3b38eSJonathan Anderson int rtld_snprintf(char *buf, size_t bufsize, const char *fmt, ...) 3602d3b38eSJonathan Anderson __printflike(3, 4); 370e9a2605SKonstantin Belousov int rtld_vsnprintf(char *buf, size_t bufsize, const char *fmt, va_list ap); 380e9a2605SKonstantin Belousov int rtld_vfdprintf(int fd, const char *fmt, va_list ap); 390e9a2605SKonstantin Belousov int rtld_fdprintf(int fd, const char *fmt, ...) __printflike(2, 3); 4077c088abSKonstantin Belousov int rtld_fdprintfx(int fd, const char *fmt, ...); 410e9a2605SKonstantin Belousov void rtld_fdputstr(int fd, const char *str); 420e9a2605SKonstantin Belousov void rtld_fdputchar(int fd, int c); 430e9a2605SKonstantin Belousov 440e9a2605SKonstantin Belousov #define rtld_printf(...) rtld_fdprintf(STDOUT_FILENO, __VA_ARGS__) 450e9a2605SKonstantin Belousov #define rtld_putstr(str) rtld_fdputstr(STDOUT_FILENO, (str)) 460e9a2605SKonstantin Belousov #define rtld_putchar(c) rtld_fdputchar(STDOUT_FILENO, (c)) 470e9a2605SKonstantin Belousov 480e9a2605SKonstantin Belousov #endif 49