compile ok for centos5.x

This commit is contained in:
zhengshuxin 2017-09-11 11:38:06 +08:00
parent 4ac182fdce
commit d5fe28dd8f
3 changed files with 13 additions and 2 deletions

View File

@ -30,7 +30,9 @@ int acl_secure_vsnprintf(char *buf, size_t size, const char *fmt, va_list ap);
# ifndef _GNU_SOURCE
# define _GNU_SOURCE
# endif
# ifndef __USE_UNIX98
# define __USE_UNIX98
# endif
# include <stdio.h>
# include <stdlib.h>
# include <unistd.h>

View File

@ -18,6 +18,12 @@
#elif defined(ACL_UNIX)
#include <stdlib.h>
#include <unistd.h>
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#ifndef __USE_UNIX98
# define __USE_UNIX98
#endif
#include <pthread.h>
#include <sys/types.h>
#include <sys/stat.h>
@ -113,7 +119,7 @@ static void init_log_mutex(acl_pthread_mutex_t *lock)
pthread_mutexattr_t attr;
n1 = pthread_mutexattr_init(&attr);
n2 = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
n2 = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
thread_mutex_init(lock, !n1 && !n2 ? &attr : NULL);
#else
thread_mutex_init(lock, NULL);

View File

@ -20,6 +20,9 @@
# ifndef _GNU_SOURCE
# define _GNU_SOURCE
# endif
# ifndef __USE_UNIX98
# define __USE_UNIX98
# endif
# include <pthread.h>
#endif