Пример #1
0
int ioctl(int handle, int command, void *buffer)
{
	FileDescriptor *descriptor = static_cast<FileDescriptor*>(GetResource(handle, OBJ_FD));
	if (descriptor == 0)
		return E_BAD_HANDLE;

	int ret = descriptor->Control(command, buffer);
	descriptor->ReleaseRef();
	return ret;
}
Пример #2
0
int rewinddir(int handle)
{
	FileDescriptor *descriptor = static_cast<FileDescriptor*>(GetResource(handle, OBJ_FD));
	if (descriptor == 0)
		return E_BAD_HANDLE;

	int ret = descriptor->RewindDir();
	descriptor->ReleaseRef();
	return ret;
}
Пример #3
0
off_t lseek(int handle, off_t offs, int whence)
{
	FileDescriptor *descriptor = static_cast<FileDescriptor*>(GetResource(handle, OBJ_FD));
	if (descriptor == 0)
		return E_BAD_HANDLE;

	off_t ret = descriptor->Seek(offs, whence);
	descriptor->ReleaseRef();
	return ret;
}
Пример #4
0
ssize_t write_pos(int handle, off_t offs, const void *in, size_t length)
{
	FileDescriptor *descriptor = static_cast<FileDescriptor*>(GetResource(handle, OBJ_FD));
	if (descriptor == 0)
		return E_BAD_HANDLE;

	size_t ret = descriptor->WriteAt(offs, in, length);
	descriptor->ReleaseRef();
	return ret;
}
Пример #5
0
ssize_t read_pos(int handle, off_t offs, void *out, size_t length)
{
	FileDescriptor *descriptor = static_cast<FileDescriptor*>(GetResource(handle, OBJ_FD));
	if (descriptor == 0)
		return E_BAD_HANDLE;

	ssize_t err = descriptor->ReadAt(offs, out, length);
	descriptor->ReleaseRef();
	return err;
}
Пример #6
0
ssize_t write(int handle, const void *in, size_t length)
{
	FileDescriptor *descriptor = static_cast<FileDescriptor*>(GetResource(handle, OBJ_FD));
	if (descriptor == 0)
		return E_BAD_HANDLE;

	ssize_t err = descriptor->Write(in, length);
	descriptor->ReleaseRef();
	return err;
}
Пример #7
0
status_t readdir(int handle, char out_path[], size_t length)
{
	FileDescriptor *descriptor = static_cast<FileDescriptor*>(GetResource(handle, OBJ_FD));
	if (descriptor == 0)
		return E_BAD_HANDLE;

	status_t ret = descriptor->ReadDir(out_path, length);
	descriptor->ReleaseRef();
	return ret;
}