155b74030SShourya Goel //===-- Implementation of fseeko ------------------------------------------===// 255b74030SShourya Goel // 355b74030SShourya Goel // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 455b74030SShourya Goel // See https://llvm.org/LICENSE.txt for license information. 555b74030SShourya Goel // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 655b74030SShourya Goel // 755b74030SShourya Goel //===----------------------------------------------------------------------===// 855b74030SShourya Goel 955b74030SShourya Goel #include "src/stdio/fseeko.h" 1055b74030SShourya Goel #include "src/__support/File/file.h" 1155b74030SShourya Goel 12*5ff3ff33SPetr Hosek #include "src/__support/macros/config.h" 1355b74030SShourya Goel #include "src/errno/libc_errno.h" 1455b74030SShourya Goel 15*5ff3ff33SPetr Hosek namespace LIBC_NAMESPACE_DECL { 1655b74030SShourya Goel 1755b74030SShourya Goel LLVM_LIBC_FUNCTION(int, fseeko, (::FILE * stream, off_t offset, int whence)) { 1855b74030SShourya Goel auto result = 1955b74030SShourya Goel reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->seek(offset, whence); 2055b74030SShourya Goel if (!result.has_value()) { 2155b74030SShourya Goel libc_errno = result.error(); 2255b74030SShourya Goel return -1; 2355b74030SShourya Goel } 2455b74030SShourya Goel return 0; 2555b74030SShourya Goel } 2655b74030SShourya Goel 27*5ff3ff33SPetr Hosek } // namespace LIBC_NAMESPACE_DECL 28