xref: /llvm-project/libc/src/stdio/generic/fileno.cpp (revision 5ff3ff33ff930e4ec49da7910612d8a41eb068cb)
1ca04b56aSShourya Goel //===-- Implementation of fileno
2ca04b56aSShourya Goel //-------------------------------------------===//
3ca04b56aSShourya Goel //
4ca04b56aSShourya Goel // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5ca04b56aSShourya Goel // See https://llvm.org/LICENSE.txt for license information.
6ca04b56aSShourya Goel // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7ca04b56aSShourya Goel //
8ca04b56aSShourya Goel //===----------------------------------------------------------------------===//
9ca04b56aSShourya Goel 
10ca04b56aSShourya Goel #include "src/stdio/fileno.h"
11ca04b56aSShourya Goel 
129340c9fbSMichael Jones #include "hdr/types/FILE.h"
13ca04b56aSShourya Goel #include "src/__support/File/file.h"
14*5ff3ff33SPetr Hosek #include "src/__support/macros/config.h"
15ca04b56aSShourya Goel 
16*5ff3ff33SPetr Hosek namespace LIBC_NAMESPACE_DECL {
17ca04b56aSShourya Goel 
18ca04b56aSShourya Goel LLVM_LIBC_FUNCTION(int, fileno, (::FILE * stream)) {
19ca04b56aSShourya Goel   return get_fileno(reinterpret_cast<LIBC_NAMESPACE::File *>(stream));
20ca04b56aSShourya Goel }
21ca04b56aSShourya Goel 
22*5ff3ff33SPetr Hosek } // namespace LIBC_NAMESPACE_DECL
23