/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
*/
/*
* Copyright 2016 Joyent, Inc.
*/
/*
* Utility functions for use in both acquire-lock and runtests.
*/
#include "util.h"
#include <err.h>
#include <errno.h>
#include <poll.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <unistd.h>
void
{
if (!LOG) {
return;
}
}
{
if (ret == -1) {
}
return (ret == 0);
}
void
{
int ret = 0;
while (ret < 1) {
if (ret == -1) {
continue;
}
}
}
void
{
int ret = 0;
while (ret < 1) {
if (ret == -1) {
continue;
}
}
}
{
return (LSTYLE_POSIX);
return (LSTYLE_OFD);
return (LSTYLE_FLOCK);
} else {
return (LSTYLE_LAST);
}
}
char *
{
switch (style) {
case LSTYLE_POSIX:
return ("posix");
case LSTYLE_OFD:
return ("ofd");
case LSTYLE_FLOCK:
return ("flock");
default:
abort();
return ("<unreachable>");
}
}
char *
{
switch (style) {
case LSTYLE_POSIX:
return ("fcntl(2) POSIX");
case LSTYLE_OFD:
return ("fcntl(2) OFD");
case LSTYLE_FLOCK:
return ("flock(3C)");
default:
abort();
return ("<unreachable>");
}
}
void
{
}
char *
{
switch (cmd) {
case F_SETLK:
return ("F_SETLK");
case F_OFD_SETLK:
return ("F_OFD_SETLK");
case F_SETLKW:
return ("F_SETLKW");
case F_OFD_SETLKW:
return ("F_OFD_SETLKW");
case F_GETLK:
return ("F_GETLK");
case F_OFD_GETLK:
return ("F_OFD_GETLK");
case F_FLOCK:
return ("F_FLOCK");
case F_FLOCKW:
return ("F_FLOCKW");
default:
abort();
return ("<unreachable>");
}
}