Path: blob/master/runtime/compiler/env/J9IO.cpp
6000 views
/*******************************************************************************1* Copyright (c) 2000, 2021 IBM Corp. and others2*3* This program and the accompanying materials are made available under4* the terms of the Eclipse Public License 2.0 which accompanies this5* distribution and is available at https://www.eclipse.org/legal/epl-2.0/6* or the Apache License, Version 2.0 which accompanies this distribution and7* is available at https://www.apache.org/licenses/LICENSE-2.0.8*9* This Source Code may also be made available under the following10* Secondary Licenses when the conditions for such availability set11* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU12* General Public License, version 2 with the GNU Classpath13* Exception [1] and GNU General Public License, version 2 with the14* OpenJDK Assembly Exception [2].15*16* [1] https://www.gnu.org/software/classpath/license.html17* [2] http://openjdk.java.net/legal/assembly-exception.html18*19* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception20*******************************************************************************/2122#include <stdio.h>23#include <stdarg.h>24#include "env/IO.hpp"25#include "env/VMJ9.h"26#include "infra/Assert.hpp"2728TR::FILE *29J9::IO::fopen(char * fileName, const char * mode)30{31return j9jit_fopen((char*)fileName, mode, false);32}333435TR::FILE *36J9::IO::fopen(char * fileName, const char * mode, bool encrypt)37{38return TR::IO::fopen(fileName, mode);39}404142void43J9::IO::fclose(TR::FILE *fileId)44{45j9jit_fclose(fileId);46}474849void50J9::IO::fseek(TR::FILE *fileId, intptr_t offset, int32_t whence)51{52::fseek(fileId->_stream, (long)offset, whence);53}545556long57J9::IO::ftell(TR::FILE *fileId)58{59return ::ftell(fileId->_stream);60}616263void64J9::IO::fflush(TR::FILE *fileId)65{66j9jit_fflush(fileId);67}686970int32_t71J9::IO::fprintf(TR::FILE *fileId, const char * format, ...)72{73va_list args;74va_start(args, format);75int32_t length = j9jit_vfprintf(fileId, (char*)format, args);76va_end(args);77return length;78}798081int32_t82J9::IO::vfprintf(TR::FILE *fileId, const char *format, va_list args)83{84return j9jit_vfprintf(fileId, (char*)format, args);85}868788