#include <sys/stat.h>
#include <sys/file.h>
#include <regex.h>
+#include <fcntl.h>
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
pl->path = strdup(path);
time(&start);
- while (((res = flock(pl->fd, LOCK_EX | LOCK_NB)) < 0) &&
- (errno == EWOULDBLOCK) && (time(NULL) - start < 5))
+ while ((
+ #ifdef SOLARIS
+ (res = fcntl(pl->fd, F_SETLK, fcntl(pl->fd,F_GETFL)|O_NONBLOCK)) < 0) &&
+ #else
+ (res = flock(pl->fd, LOCK_EX | LOCK_NB)) < 0) &&
+ #endif
+ (errno == EWOULDBLOCK) &&
+ (time(NULL) - start < 5))
usleep(1000);
if (res) {
ast_log(LOG_WARNING, "Failed to lock path '%s': %s\n",
#if defined(HAVE_SYSINFO)
#include <sys/sysinfo.h>
#endif
+#if defined(SOLARIS)
+#include <sys/loadavg.h>
+#endif
#include "asterisk/lock.h"
#include "asterisk/cli.h"