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

/*
 *	uname(s)
 *	struct utsname *s;
 *
 *	tell something about which system version we're on
 */

#include <sys/utsname.h>

#define WHOFILE "/etc/whoami"

int
uname(s)
	struct utsname *s;
{
	static struct utsname clear;

	register int fd, i;

	*s = clear;

	/* read the system identity */
	fd = open (WHOFILE, 0);
	if (fd < 0)
		return -1;
	read (fd, s->nodename, sizeof (s->nodename) - 1);
	close(fd);

	/* find the trailing \n if any and make it \0 */
	for (i = 0; i < sizeof (s->nodename); i++)
		if (s->nodename[i] == '\n')
			s->nodename[i] = '\0';
	
	/* provide additional identifying information */
	strcpy (s->sysname, s->nodename);
	strcpy (s->release, "V8");
	strcpy (s->version, "0");

	return 0;
}

unix.superglobalmegacorp.com

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