/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <fcntl.h>
#include <dirent.h>
#include <unistd.h>
#include <pwd.h>
#include <grp.h>
#include <errno.h>
#include <dlfcn.h>
#ifdef __solaris__
#include <strings.h>
#endif
#ifdef __linux__
#include <string.h>
#endif
#ifdef _ALLBSD_SOURCE
#include <string.h>
#endif
#include "jni.h"
#include "jni_util.h"
#include "jlong.h"
#include "sun_nio_fs_UnixNativeDispatcher.h"
/**
* Size of password or group entry when not available via sysconf
*/
do { \
} while(0)
do { \
} while(0)
/**
* System calls that may not be available at run time.
*/
typedef int openat64_func(int, const char *, int, ...);
typedef int unlinkat_func(int, const char*, int);
typedef int renameat_func(int, const char*, int, const char*);
/**
* fstatat missing from glibc on Linux. Temporary workaround
*/
#define FSTATAT64_SYSCALL_AVAILABLE
{
#ifndef __NR_fstatat64
#endif
}
#endif
#if defined(__linux__) && defined(__x86_64__)
#define FSTATAT64_SYSCALL_AVAILABLE
{
#ifndef __NR_newfstatat
#endif
}
#endif
/**
* call fails
*/
"(I)V", errnum);
if (x != NULL) {
}
}
/**
* Initialization
*/
{
return 0;
}
return 0;
}
return 0;
}
/* system calls that might not be available at run time */
#else
#endif
#if defined(FSTATAT64_SYSCALL_AVAILABLE)
/* fstatat64 missing from glibc */
if (my_fstatat64_func == NULL)
#endif
{
}
return flags;
}
/* EINTR not listed as a possible error */
} else {
}
}
return result;
}
{
char* msg;
}
return bytes;
}
if (fd == -1) {
}
}
{
do {
}
return ptr_to_jlong(fp);
}
{
int res;
do {
}
}
{
if (fd == -1) {
}
return fd;
}
{
if (my_openat64_func == NULL) {
return -1;
}
if (fd == -1) {
}
return fd;
}
int err;
/* TDB - need to decide if EIO and other errors should cause exception */
}
{
ssize_t n;
if (n == -1) {
}
return (jint)n;
}
{
ssize_t n;
if (n == -1) {
}
return (jint)n;
}
/**
* Copy stat64 members into sun.nio.fs.UnixFileAttributes
*/
}
{
int err;
if (err == -1) {
} else {
}
}
{
int err;
if (err == -1) {
} else {
}
}
{
int err;
if (err == -1) {
} else {
}
}
{
int err;
if (my_fstatat64_func == NULL) {
return;
}
if (err == -1) {
} else {
}
}
{
int err;
if (err == -1) {
}
}
{
int err;
if (err == -1) {
}
}
{
int err;
if (err == -1) {
}
}
Java_sun_nio_fs_UnixNativeDispatcher_lchown0(JNIEnv* env, jclass this, jlong pathAddress, jint uid, jint gid)
{
int err;
if (err == -1) {
}
}
Java_sun_nio_fs_UnixNativeDispatcher_fchown(JNIEnv* env, jclass this, jint filedes, jint uid, jint gid)
{
int err;
if (err == -1) {
}
}
{
int err;
if (err == -1) {
}
}
{
int err = 0;
#ifdef _ALLBSD_SOURCE
#else
if (my_futimesat_func == NULL) {
return;
}
#endif
if (err == -1) {
}
}
{
/* EINTR not listed as a possible error */
}
return ptr_to_jlong(dir);
}
if (my_fdopendir_func == NULL) {
return (jlong)-1;
}
/* EINTR not listed as a possible error */
}
return ptr_to_jlong(dir);
}
int err;
if (errno == -1) {
}
}
struct {
} entry;
int res;
/* EINTR not listed as a possible error */
/* TDB: reentrant version probably not required here */
if (res != 0) {
return NULL;
} else {
return NULL;
} else {
}
return bytes;
}
}
}
{
/* EINTR not listed as a possible error */
}
}
{
/* EINTR not listed as a possible error */
}
}
{
int err;
if (err == -1) {
}
}
{
/* EINTR not listed as a possible error */
}
}
{
if (my_unlinkat_func == NULL) {
return;
}
/* EINTR not listed as a possible error */
}
}
{
/* EINTR not listed as a possible error */
}
}
{
if (my_renameat_func == NULL) {
return;
}
/* EINTR not listed as a possible error */
}
}
{
/* EINTR not listed as a possible error */
}
}
{
/* EINTR not listed as a possible error */
if (n == -1) {
} else {
if (n == sizeof(target)) {
n--;
}
target[n] = '\0';
}
}
return result;
}
{
/* EINTR not listed as a possible error */
} else {
}
}
return result;
}
{
int err;
if (err == -1) {
}
}
{
int err;
if (err == -1) {
} else {
}
}
{
long err;
if (err == -1) {
}
}
{
long err;
if (err == -1) {
}
}
{
int err;
if (err == -1) {
}
}
{
int buflen;
char* pwbuf;
/* allocate buffer for password record */
if (buflen == -1)
} else {
int res = 0;
errno = 0;
#ifdef __solaris__
#else
#endif
/* not found or error */
if (errno == 0)
} else {
}
}
}
return result;
}
{
int buflen;
int retry;
/* initial size of buffer for group record */
if (buflen == -1)
do {
int res = 0;
return NULL;
}
errno = 0;
#ifdef __solaris__
#else
#endif
retry = 0;
/* not found or error */
/* insufficient buffer size so need larger buffer */
buflen += ENT_BUF_SIZE;
retry = 1;
} else {
if (errno == 0)
}
} else {
}
}
} while (retry);
return result;
}
{
int buflen;
char* pwbuf;
/* allocate buffer for password record */
if (buflen == -1)
} else {
int res = 0;
errno = 0;
#ifdef __solaris__
#else
#endif
/* not found or error */
} else {
}
}
return uid;
}
{
/* initial size of buffer for group record */
if (buflen == -1)
do {
int res = 0;
char *grbuf;
return -1;
}
errno = 0;
#ifdef __solaris__
#else
#endif
retry = 0;
/* not found or error */
/* insufficient buffer size so need larger buffer */
buflen += ENT_BUF_SIZE;
retry = 1;
} else {
}
}
} else {
}
} while (retry);
return gid;
}