示例#1
0
文件: dio.c 项目: CSRedRat/ldt
int input(int dev, void *buf, int size)
{
	ret = 0;
#ifdef VERBOSE
_entry:
	trl_();
	trvd(size);
#endif
	if (dev < 0 || wo)
		return 0;
	switch (io_type) {
	case mmap_io:
		memcpy(buf, mem, size);
		ret = size;
		break;
	case ioctl_io:
		ioctl(dev, _IOC(_IOC_READ, ioctl_type, ioctl_num, size & _IOC_SIZEMASK), buf);
		ret = size;
		break;
	case file_io:
	default:
		ret = read(dev, buf, size);
	}
	return ret;
}
示例#2
0
int main(void)
{	_entry:;
	int i;
	for (i=0; i < 10; i++)
		sub();
	trl();
	trvp(i);
	trvx(i);
	trvd(i);
	trvd(sizeof(long long));
	trvd(sizeof(size_t));
	trvd(sizeof(void*));
	trvd(sizeof(int));
	trvd(sizeof(short));
	trvd(sizeof(char));
	return 0;
}
示例#3
0
文件: dio.c 项目: CSRedRat/ldt
int output(int dev, void *buf, int size)
{
#ifdef VERBOSE
_entry:
	trl_();
	trvd(size);
#endif
	ret = 0;
	if (dev < 0 || ro)
		return 0;
	switch (io_type) {
	case mmap_io:
		memcpy(mem, buf, size);
		ret = size;
		break;
	case ioctl_io:
		ioctl(dev, _IOC(_IOC_WRITE, ioctl_type, ioctl_num, size & _IOC_SIZEMASK), buf);
		break;
	case file_io:
	default:
		ret = write(dev, buf, size);
	}
	return ret;
}