File:  [Research Unix] / researchv9 / ipc / src / perf / timingd.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:59 2018 UTC (8 years, 1 month ago) by root
Branches: belllabs, MAIN
CVS tags: researchv9-SUN3_old, researchv9-SUN3, HEAD
researchv9-SUN3(old)

#include <stdio.h>
#include <sys/ioctl.h>
main()
{
	struct passfd pass;
	int fd, nfd;
	char c;
	extern int errno;

	if((fd=domount("quux"))<0)
		exit(errno);
	fprintf(stderr, "domount(quux) returns %d\n", fd);
	for(;;) {
		if (ioctl(fd, FIORCVFD, &pass)<0) {
			close(fd);
			exit(2);
		}
		fprintf(stderr, "ioctl(fd, FIORCVFD, &pass) returns %d\n",pass.fd);
		nfd = pass.fd;
		(void)ioctl(nfd, FIOACCEPT, &pass);
		fprintf(stderr, "ioctl(fd, FIOACCEPT, &pass) returned\n");
		read(nfd, &c, 1);
		close(nfd);
	}
}

domount(name)
	char *name;
{
	int pfd[2];
	extern int conn_ld;
	
	if (pipe(pfd) < 0)
		return -1;
	if (ioctl(pfd[1], FIOPUSHLD, &conn_ld) < 0)
		return -1;

	/* mount */
	if (fmount(3, pfd[1], name, 0) < 0)
		return -1;
	close(pfd[1]);
	return(pfd[0]);
}

unix.superglobalmegacorp.com

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