File:  [Research Unix] / researchv9 / libc / gen / putshares.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)

/*LINTLIBRARY*/

/*
**	Write a new ``shares'' file record from details in lnode.
**
**	Returns 0 for illegal uid,
**		SYSERROR for bad system call,
**		else sizeof(Share).
*/ 

#include	<sys/types.h>
#include	<sys/lnode.h>
#include	<shares.h>
#include	<libc.h>


int
putshares(lp, extime)
	register struct lnode *	lp;
	unsigned long		extime;
{
	register long		posn;
	Share			share;

	if ( lp->l_uid > MAXUID )
		return 0;

	if ( !openshares(1) )
		return SYSERROR;

	share.l = *lp;
	share.extime = extime;

	posn = sizeof(Share) * lp->l_uid;

	if ( lseek(ShareFd, posn, 0) == SYSERROR )
		return SYSERROR;

	return write(ShareFd, &share, sizeof(Share));
}

unix.superglobalmegacorp.com

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