Bug 1854550 - pt 12. Allow inlining between mozjemalloc and PHC r=glandium
[gecko.git] / memory / build / FdPrintf.h
blob257084243b66f1c2d697aeaf73e327aa6cd6a054
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef __FdPrintf_h__
8 #define __FdPrintf_h__
10 /* We can't use libc's (f)printf because it would reenter in replace_malloc,
11 * So use a custom and simplified version. Only %p, %zu, %s and %% are
12 * supported, %zu, %s, support width specifiers.
14 * /!\ This function used a fixed-size internal buffer. The caller is
15 * expected to not use a format string that may overflow.
16 * The aFd argument is a file descriptor on UNIX and a native win32 file
17 * handle on Windows (from CreateFile). We can't use the windows POSIX
18 * APIs is that they don't support O_APPEND in a multi-process-safe way,
19 * while CreateFile does.
21 void FdPrintf(intptr_t aFd, const char* aFormat, ...)
22 #ifdef __GNUC__
23 __attribute__((format(printf, 2, 3)))
24 #endif
27 #endif /* __FdPrintf_h__ */