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/. */
11 typedef void* platform_handle_t
;
13 typedef int platform_handle_t
;
16 /* We can't use libc's (f)printf because it would reenter in replace_malloc,
17 * So use a custom and simplified version. Only %p, %zu, %s and %% are
18 * supported, %zu, %s, support width specifiers.
20 * /!\ This function used a fixed-size internal buffer. The caller is
21 * expected to not use a format string that may overflow.
22 * The aFd argument is a file descriptor on UNIX and a native win32 file
23 * handle on Windows (from CreateFile). We can't use the windows POSIX
24 * APIs is that they don't support O_APPEND in a multi-process-safe way,
25 * while CreateFile does.
27 void FdPrintf(platform_handle_t aFd
, const char* aFormat
, ...)
29 __attribute__((format(printf
, 2, 3)))
33 #endif /* __FdPrintf_h__ */