mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 12:36:58 +00:00
Fixes Solaris build warnings
(closes issue #10698, reported and patched by snuffy) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@82283 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
11
main/app.c
11
main/app.c
@@ -39,6 +39,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
#include <regex.h>
|
#include <regex.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
#include "asterisk/channel.h"
|
#include "asterisk/channel.h"
|
||||||
#include "asterisk/pbx.h"
|
#include "asterisk/pbx.h"
|
||||||
@@ -1146,8 +1147,14 @@ static enum AST_LOCK_RESULT ast_lock_path_flock(const char *path)
|
|||||||
pl->path = strdup(path);
|
pl->path = strdup(path);
|
||||||
|
|
||||||
time(&start);
|
time(&start);
|
||||||
while (((res = flock(pl->fd, LOCK_EX | LOCK_NB)) < 0) &&
|
while ((
|
||||||
(errno == EWOULDBLOCK) && (time(NULL) - start < 5))
|
#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);
|
usleep(1000);
|
||||||
if (res) {
|
if (res) {
|
||||||
ast_log(LOG_WARNING, "Failed to lock path '%s': %s\n",
|
ast_log(LOG_WARNING, "Failed to lock path '%s': %s\n",
|
||||||
|
@@ -95,6 +95,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#if defined(SOLARIS)
|
#if defined(SOLARIS)
|
||||||
int daemon(int, int); /* defined in libresolv of all places */
|
int daemon(int, int); /* defined in libresolv of all places */
|
||||||
|
#include <sys/loadavg.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -40,6 +40,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
#if defined(HAVE_SYSINFO)
|
#if defined(HAVE_SYSINFO)
|
||||||
#include <sys/sysinfo.h>
|
#include <sys/sysinfo.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(SOLARIS)
|
||||||
|
#include <sys/loadavg.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "asterisk/lock.h"
|
#include "asterisk/lock.h"
|
||||||
#include "asterisk/cli.h"
|
#include "asterisk/cli.h"
|
||||||
|
Reference in New Issue
Block a user