/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
#pragma ident "%Z%%M% %I% %E% SMI"
#include "lint.h"
#include <stdio.h>
#include <signal.h>
#include <fcntl.h>
#include <unistd.h>
#include <shadow.h>
#include <errno.h>
#include <thread.h>
#include "mtlib.h"
0, /* l_type */
0, /* l_whence */
0, /* l_start */
0, /* l_len */
0, /* l_sysid */
0 /* l_pid */
};
/*
* lckpwdf() returns a 0 for a successful lock within W_WAITTIME
* seconds and -1 otherwise. We stand on our head to make it MT-safe.
*/
int
lckpwdf(void)
{
int seconds = 0;
for (;;) {
/* somebody forked */
lck_pid = 0;
lck_tid = 0;
}
if (lck_tid == 0) {
break;
return (0);
}
fildes = -1;
}
if (seconds++ >= S_WAITTIME) {
/*
* For compatibility with the past, pretend
* that we were interrupted by SIGALRM.
*/
break;
}
(void) sleep(1);
}
return (-1);
}
/*
* ulckpwdf() returns 0 for a successful unlock and -1 otherwise
*/
int
ulckpwdf(void)
{
fildes = -1;
lck_pid = 0;
lck_tid = 0;
return (0);
}
return (-1);
}