File:  [Research Unix] / researchv10dc / cmd / post / sys.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:33 2018 UTC (8 years, 3 months ago) by root
Branches: belllabs, MAIN
CVS tags: researchv10, HEAD
researchv10 Dan Cross

/*
 * System call module
 */

#include <fcntl.h>

char	sys_fd[1];

char *
sys_open(argv)
char	*argv[];
{
	int	fd;

	if ((fd = open(argv[0], O_RDWR)) < 0) {
		error(-1, argv[0]);
		return 0;
	}
	return sys_fd + fd;
}

sys_close(fd)
char	*fd;
{
	close(fd - sys_fd);
	return 0;
}

sys_read(fd, buf, n)
char	*fd, *buf;
{
	return read(fd - sys_fd, buf, n);
}

sys_write(fd, buf, n)
char	*fd, *buf;
{
	return write(fd - sys_fd, buf, n);
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.