Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/bin/jli_util.h
38769 views
/*1* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425#ifndef _JLI_UTIL_H26#define _JLI_UTIL_H2728#include <stdlib.h>29#include <string.h>30#include <stdio.h>31#include <jni.h>32#define JLDEBUG_ENV_ENTRY "_JAVA_LAUNCHER_DEBUG"3334void *JLI_MemAlloc(size_t size);35void *JLI_MemRealloc(void *ptr, size_t size);36char *JLI_StringDup(const char *s1);37void JLI_MemFree(void *ptr);38int JLI_StrCCmp(const char *s1, const char* s2);3940typedef struct {41char *arg;42jboolean has_wildcard;43} StdArg;4445StdArg *JLI_GetStdArgs();46int JLI_GetStdArgc();4748#define JLI_StrLen(p1) strlen((p1))49#define JLI_StrChr(p1, p2) strchr((p1), (p2))50#define JLI_StrRChr(p1, p2) strrchr((p1), (p2))51#define JLI_StrCmp(p1, p2) strcmp((p1), (p2))52#define JLI_StrNCmp(p1, p2, p3) strncmp((p1), (p2), (p3))53#define JLI_StrCat(p1, p2) strcat((p1), (p2))54#define JLI_StrCpy(p1, p2) strcpy((p1), (p2))55#define JLI_StrNCpy(p1, p2, p3) strncpy((p1), (p2), (p3))56#define JLI_StrStr(p1, p2) strstr((p1), (p2))57#define JLI_StrSpn(p1, p2) strspn((p1), (p2))58#define JLI_StrCSpn(p1, p2) strcspn((p1), (p2))59#define JLI_StrPBrk(p1, p2) strpbrk((p1), (p2))6061/* On Windows lseek() is in io.h rather than the location dictated by POSIX. */62#ifdef _WIN3263#include <windows.h>64#include <io.h>65#include <process.h>66#define JLI_StrCaseCmp(p1, p2) stricmp((p1), (p2))67#define JLI_StrNCaseCmp(p1, p2, p3) strnicmp((p1), (p2), (p3))68int JLI_Snprintf(char *buffer, size_t size, const char *format, ...);69void JLI_CmdToArgs(char *cmdline);70#define JLI_Lseek _lseeki6471#define JLI_PutEnv _putenv72#define JLI_GetPid _getpid73#else /* NIXES */74#include <unistd.h>75#include <strings.h>76#define JLI_StrCaseCmp(p1, p2) strcasecmp((p1), (p2))77#define JLI_StrNCaseCmp(p1, p2, p3) strncasecmp((p1), (p2), (p3))78#define JLI_Snprintf snprintf79#define JLI_PutEnv putenv80#define JLI_GetPid getpid81#ifdef __solaris__82#define JLI_Lseek llseek83#endif84#ifdef __linux__85#define _LARGFILE64_SOURCE86#define JLI_Lseek lseek6487#endif88#ifdef MACOSX89#define JLI_Lseek lseek90#endif91#ifdef _AIX92#define JLI_Lseek lseek93#endif94#endif /* _WIN32 */9596/*97* Make launcher spit debug output.98*/99void JLI_TraceLauncher(const char* fmt, ...);100void JLI_SetTraceLauncher();101jboolean JLI_IsTraceLauncher();102103#endif /* _JLI_UTIL_H */104105106