filedescriptor.c

来自「kaffe是一个java虚拟机的源代码。里面包含了一些java例程和标准的jav」· C语言 代码 · 共 66 行

C
66
字号
/* * java.io.FileDescriptor.c * * Copyright (c) 1996, 1997 *	Transvirtual Technologies, Inc.  All rights reserved. * * See the file "license.terms" for information on usage and redistribution  * of this file.  */#include "config.h"#include "config-std.h"#include "config-io.h"#include "files.h"#include "java_io_FileDescriptor.h"#include "jsyscall.h"#include "../../../kaffe/kaffevm/support.h"/* * Initialise a file descriptor to the given file nr. */struct Hjava_io_FileDescriptor*java_io_FileDescriptor_initSystemFD(struct Hjava_io_FileDescriptor* this, jint i){	unhand(this)->fd = i;	return (this);}/* * Is this file descriptor valid ? */jbooljava_io_FileDescriptor_valid(struct Hjava_io_FileDescriptor* this){	if (unhand(this)->fd >= 0) {		return (1);	}	else {		return (0);	}}/* * Synchronise this file descriptor with the real file system. */voidjava_io_FileDescriptor_sync(struct Hjava_io_FileDescriptor* this){#if defined(HAVE_FSYNC)	if (unhand(this)->fd >= 0) {		/* XXX make part of jsyscall --- errno is unprotected */		int r = fsync(unhand(this)->fd);		if (r < 0) {			SignalError("java.io.SyncFailedException", SYS_ERROR(errno));		}	}#elif defined(HAVE_SYNC)	/* Fallback on a full sync */	/* XXX make part of jsyscall */	sync();#else	/* Well we can't do anything can we? */	SignalError("java.io.SyncFailedException", "no sync supported");#endif}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?