feat:replace boost library with C++11 std library
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ATOMIC_H
|
||||
#define ATOMIC_H
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_private.h"
|
||||
#include "apr_atomic.h"
|
||||
#include "apr_thread_mutex.h"
|
||||
|
||||
#if defined(USE_ATOMICS_GENERIC)
|
||||
/* noop */
|
||||
#elif defined(__GNUC__) && defined(__STRICT_ANSI__)
|
||||
/* force use of generic atomics if building e.g. with -std=c89, which
|
||||
* doesn't allow inline asm */
|
||||
# define USE_ATOMICS_GENERIC
|
||||
#elif HAVE_ATOMIC_BUILTINS
|
||||
# define USE_ATOMICS_BUILTINS
|
||||
#elif defined(SOLARIS2) && SOLARIS2 >= 10
|
||||
# define USE_ATOMICS_SOLARIS
|
||||
#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
|
||||
# define USE_ATOMICS_IA32
|
||||
#elif defined(__GNUC__) && (defined(__PPC__) || defined(__ppc__))
|
||||
# define USE_ATOMICS_PPC
|
||||
#elif defined(__GNUC__) && (defined(__s390__) || defined(__s390x__))
|
||||
# define USE_ATOMICS_S390
|
||||
#else
|
||||
# define USE_ATOMICS_GENERIC
|
||||
#endif
|
||||
|
||||
#endif /* ATOMIC_H */
|
||||
@@ -0,0 +1,63 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef DSO_H
|
||||
#define DSO_H
|
||||
|
||||
#include "apr_private.h"
|
||||
#include "apr_general.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_dso.h"
|
||||
#include "apr.h"
|
||||
|
||||
#if APR_HAS_DSO
|
||||
|
||||
#ifdef HAVE_MACH_O_DYLD_H
|
||||
#include <mach-o/dyld.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DLFCN_H
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DL_H
|
||||
#include <dl.h>
|
||||
#endif
|
||||
|
||||
#ifndef RTLD_NOW
|
||||
#define RTLD_NOW 1
|
||||
#endif
|
||||
|
||||
#ifndef RTLD_GLOBAL
|
||||
#define RTLD_GLOBAL 0
|
||||
#endif
|
||||
|
||||
#if (defined(__DragonFly__) ||\
|
||||
defined(__FreeBSD__) ||\
|
||||
defined(__OpenBSD__) ||\
|
||||
defined(__NetBSD__) ) && !defined(__ELF__)
|
||||
#define DLSYM_NEEDS_UNDERSCORE
|
||||
#endif
|
||||
|
||||
struct apr_dso_handle_t {
|
||||
apr_pool_t *pool;
|
||||
void *handle;
|
||||
const char *errormsg;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,174 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef FILE_IO_H
|
||||
#define FILE_IO_H
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_private.h"
|
||||
#include "apr_general.h"
|
||||
#include "apr_tables.h"
|
||||
#include "apr_file_io.h"
|
||||
#include "apr_file_info.h"
|
||||
#include "apr_errno.h"
|
||||
#include "apr_lib.h"
|
||||
#include "apr_thread_mutex.h"
|
||||
#ifndef WAITIO_USES_POLL
|
||||
#include "apr_poll.h"
|
||||
#endif
|
||||
|
||||
/* System headers the file I/O library needs */
|
||||
#if APR_HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#if APR_HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#if APR_HAVE_ERRNO_H
|
||||
#include <errno.h>
|
||||
#endif
|
||||
#if APR_HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#if APR_HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
#if APR_HAVE_DIRENT_H
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
#if APR_HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#if APR_HAVE_STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#if APR_HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#if APR_HAVE_SYS_UIO_H
|
||||
#include <sys/uio.h>
|
||||
#endif
|
||||
#if APR_HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#ifdef BEOS
|
||||
#include <kernel/OS.h>
|
||||
#endif
|
||||
/* Hunting down DEV_BSIZE if not from dirent.h, sys/stat.h etc */
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#if BEOS_BONE
|
||||
# ifndef BONE7
|
||||
/* prior to BONE/7 fd_set & select were defined in sys/socket.h */
|
||||
# include <sys/socket.h>
|
||||
# else
|
||||
/* Be moved the fd_set stuff and also the FIONBIO definition... */
|
||||
# include <sys/ioctl.h>
|
||||
# endif
|
||||
#endif
|
||||
/* End System headers */
|
||||
|
||||
#define APR_FILE_DEFAULT_BUFSIZE 4096
|
||||
/* For backwards-compat */
|
||||
#define APR_FILE_BUFSIZE APR_FILE_DEFAULT_BUFSIZE
|
||||
|
||||
struct apr_file_t {
|
||||
apr_pool_t *pool;
|
||||
int filedes;
|
||||
char *fname;
|
||||
apr_int32_t flags;
|
||||
int eof_hit;
|
||||
int is_pipe;
|
||||
apr_interval_time_t timeout;
|
||||
int buffered;
|
||||
enum {BLK_UNKNOWN, BLK_OFF, BLK_ON } blocking;
|
||||
int ungetchar; /* Last char provided by an unget op. (-1 = no char)*/
|
||||
#ifndef WAITIO_USES_POLL
|
||||
/* if there is a timeout set, then this pollset is used */
|
||||
apr_pollset_t *pollset;
|
||||
#endif
|
||||
/* Stuff for buffered mode */
|
||||
char *buffer;
|
||||
apr_size_t bufpos; /* Read/Write position in buffer */
|
||||
apr_size_t bufsize; /* The size of the buffer */
|
||||
unsigned long dataRead; /* amount of valid data read into buffer */
|
||||
int direction; /* buffer being used for 0 = read, 1 = write */
|
||||
apr_off_t filePtr; /* position in file of handle */
|
||||
#if APR_HAS_THREADS
|
||||
struct apr_thread_mutex_t *thlock;
|
||||
#endif
|
||||
};
|
||||
|
||||
#if APR_HAS_THREADS
|
||||
#define file_lock(f) do { \
|
||||
if ((f)->thlock) \
|
||||
apr_thread_mutex_lock((f)->thlock); \
|
||||
} while (0)
|
||||
#define file_unlock(f) do { \
|
||||
if ((f)->thlock) \
|
||||
apr_thread_mutex_unlock((f)->thlock); \
|
||||
} while (0)
|
||||
#else
|
||||
#define file_lock(f) do {} while (0)
|
||||
#define file_unlock(f) do {} while (0)
|
||||
#endif
|
||||
|
||||
#if APR_HAS_LARGE_FILES && defined(_LARGEFILE64_SOURCE)
|
||||
#define stat(f,b) stat64(f,b)
|
||||
#define lstat(f,b) lstat64(f,b)
|
||||
#define fstat(f,b) fstat64(f,b)
|
||||
#define lseek(f,o,w) lseek64(f,o,w)
|
||||
#define ftruncate(f,l) ftruncate64(f,l)
|
||||
typedef struct stat64 struct_stat;
|
||||
#else
|
||||
typedef struct stat struct_stat;
|
||||
#endif
|
||||
|
||||
/* readdir64_r is only used in specific cases: */
|
||||
#if APR_HAS_THREADS && defined(_POSIX_THREAD_SAFE_FUNCTIONS) \
|
||||
&& !defined(READDIR_IS_THREAD_SAFE) && defined(HAVE_READDIR64_R)
|
||||
#define APR_USE_READDIR64_R
|
||||
#endif
|
||||
|
||||
struct apr_dir_t {
|
||||
apr_pool_t *pool;
|
||||
char *dirname;
|
||||
DIR *dirstruct;
|
||||
#ifdef APR_USE_READDIR64_R
|
||||
struct dirent64 *entry;
|
||||
#else
|
||||
struct dirent *entry;
|
||||
#endif
|
||||
};
|
||||
|
||||
apr_status_t apr_unix_file_cleanup(void *);
|
||||
apr_status_t apr_unix_child_file_cleanup(void *);
|
||||
|
||||
mode_t apr_unix_perms2mode(apr_fileperms_t perms);
|
||||
apr_fileperms_t apr_unix_mode2perms(mode_t mode);
|
||||
|
||||
apr_status_t apr_file_flush_locked(apr_file_t *thefile);
|
||||
apr_status_t apr_file_info_get_locked(apr_finfo_t *finfo, apr_int32_t wanted,
|
||||
apr_file_t *thefile);
|
||||
|
||||
|
||||
#endif /* ! FILE_IO_H */
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef GLOBAL_MUTEX_H
|
||||
#define GLOBAL_MUTEX_H
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_private.h"
|
||||
#include "apr_general.h"
|
||||
#include "apr_lib.h"
|
||||
#include "apr_global_mutex.h"
|
||||
#include "apr_arch_proc_mutex.h"
|
||||
#include "apr_arch_thread_mutex.h"
|
||||
|
||||
struct apr_global_mutex_t {
|
||||
apr_pool_t *pool;
|
||||
apr_proc_mutex_t *proc_mutex;
|
||||
#if APR_HAS_THREADS
|
||||
apr_thread_mutex_t *thread_mutex;
|
||||
#endif /* APR_HAS_THREADS */
|
||||
};
|
||||
|
||||
#endif /* GLOBAL_MUTEX_H */
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef INHERIT_H
|
||||
#define INHERIT_H
|
||||
|
||||
#include "apr_inherit.h"
|
||||
|
||||
#define APR_INHERIT (1 << 24) /* Must not conflict with other bits */
|
||||
|
||||
#define APR_IMPLEMENT_INHERIT_SET(name, flag, pool, cleanup) \
|
||||
apr_status_t apr_##name##_inherit_set(apr_##name##_t *the##name) \
|
||||
{ \
|
||||
if (the##name->flag & APR_FOPEN_NOCLEANUP) \
|
||||
return APR_EINVAL; \
|
||||
if (!(the##name->flag & APR_INHERIT)) { \
|
||||
int flags = fcntl(the##name->name##des, F_GETFD); \
|
||||
if (flags == -1) \
|
||||
return errno; \
|
||||
flags &= ~(FD_CLOEXEC); \
|
||||
if (fcntl(the##name->name##des, F_SETFD, flags) == -1) \
|
||||
return errno; \
|
||||
the##name->flag |= APR_INHERIT; \
|
||||
apr_pool_child_cleanup_set(the##name->pool, \
|
||||
(void *)the##name, \
|
||||
cleanup, apr_pool_cleanup_null); \
|
||||
} \
|
||||
return APR_SUCCESS; \
|
||||
}
|
||||
|
||||
#define APR_IMPLEMENT_INHERIT_UNSET(name, flag, pool, cleanup) \
|
||||
apr_status_t apr_##name##_inherit_unset(apr_##name##_t *the##name) \
|
||||
{ \
|
||||
if (the##name->flag & APR_FOPEN_NOCLEANUP) \
|
||||
return APR_EINVAL; \
|
||||
if (the##name->flag & APR_INHERIT) { \
|
||||
int flags; \
|
||||
if ((flags = fcntl(the##name->name##des, F_GETFD)) == -1) \
|
||||
return errno; \
|
||||
flags |= FD_CLOEXEC; \
|
||||
if (fcntl(the##name->name##des, F_SETFD, flags) == -1) \
|
||||
return errno; \
|
||||
the##name->flag &= ~APR_INHERIT; \
|
||||
apr_pool_child_cleanup_set(the##name->pool, \
|
||||
(void *)the##name, \
|
||||
cleanup, cleanup); \
|
||||
} \
|
||||
return APR_SUCCESS; \
|
||||
}
|
||||
|
||||
#endif /* ! INHERIT_H */
|
||||
@@ -0,0 +1,24 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef TIME_INTERNAL_H
|
||||
#define TIME_INTERNAL_H
|
||||
|
||||
#include "apr.h"
|
||||
|
||||
void apr_unix_setup_time(void);
|
||||
|
||||
#endif /* TIME_INTERNAL_H */
|
||||
@@ -0,0 +1,67 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef MISC_H
|
||||
#define MISC_H
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_portable.h"
|
||||
#include "apr_private.h"
|
||||
#include "apr_general.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_getopt.h"
|
||||
#include "apr_thread_proc.h"
|
||||
#include "apr_file_io.h"
|
||||
#include "apr_errno.h"
|
||||
#include "apr_getopt.h"
|
||||
|
||||
#if APR_HAVE_STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#if APR_HAVE_SIGNAL_H
|
||||
#include <signal.h>
|
||||
#endif
|
||||
#if APR_HAVE_PTHREAD_H
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
#if APR_HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#if APR_HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#ifdef BEOS
|
||||
#include <kernel/OS.h>
|
||||
#endif
|
||||
|
||||
struct apr_other_child_rec_t {
|
||||
apr_pool_t *p;
|
||||
struct apr_other_child_rec_t *next;
|
||||
apr_proc_t *proc;
|
||||
void (*maintenance) (int, void *, int);
|
||||
void *data;
|
||||
apr_os_file_t write_fd;
|
||||
};
|
||||
|
||||
#if defined(WIN32) || defined(NETWARE)
|
||||
#define WSAHighByte 2
|
||||
#define WSALowByte 0
|
||||
#endif
|
||||
|
||||
#endif /* ! MISC_H */
|
||||
|
||||
@@ -0,0 +1,145 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef NETWORK_IO_H
|
||||
#define NETWORK_IO_H
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_private.h"
|
||||
#include "apr_network_io.h"
|
||||
#include "apr_errno.h"
|
||||
#include "apr_general.h"
|
||||
#include "apr_lib.h"
|
||||
#ifndef WAITIO_USES_POLL
|
||||
#include "apr_poll.h"
|
||||
#endif
|
||||
|
||||
/* System headers the network I/O library needs */
|
||||
#if APR_HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#if APR_HAVE_SYS_UIO_H
|
||||
#include <sys/uio.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
#if APR_HAVE_ERRNO_H
|
||||
#include <errno.h>
|
||||
#endif
|
||||
#if APR_HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#if APR_HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#if APR_HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#if APR_HAVE_NETINET_TCP_H
|
||||
#include <netinet/tcp.h>
|
||||
#endif
|
||||
#if APR_HAVE_NETINET_SCTP_UIO_H
|
||||
#include <netinet/sctp_uio.h>
|
||||
#endif
|
||||
#if APR_HAVE_NETINET_SCTP_H
|
||||
#include <netinet/sctp.h>
|
||||
#endif
|
||||
#if APR_HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#if APR_HAVE_ARPA_INET_H
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
#if APR_HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#if APR_HAVE_SYS_SOCKIO_H
|
||||
#include <sys/sockio.h>
|
||||
#endif
|
||||
#if APR_HAVE_NETDB_H
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
#if APR_HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#if APR_HAVE_SYS_SENDFILE_H
|
||||
#include <sys/sendfile.h>
|
||||
#endif
|
||||
#if APR_HAVE_SYS_IOCTL_H
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
/* End System Headers */
|
||||
|
||||
#ifndef HAVE_POLLIN
|
||||
#define POLLIN 1
|
||||
#define POLLPRI 2
|
||||
#define POLLOUT 4
|
||||
#define POLLERR 8
|
||||
#define POLLHUP 16
|
||||
#define POLLNVAL 32
|
||||
#endif
|
||||
|
||||
typedef struct sock_userdata_t sock_userdata_t;
|
||||
struct sock_userdata_t {
|
||||
sock_userdata_t *next;
|
||||
const char *key;
|
||||
void *data;
|
||||
};
|
||||
|
||||
struct apr_socket_t {
|
||||
apr_pool_t *pool;
|
||||
int socketdes;
|
||||
int type;
|
||||
int protocol;
|
||||
apr_sockaddr_t *local_addr;
|
||||
apr_sockaddr_t *remote_addr;
|
||||
apr_interval_time_t timeout;
|
||||
#ifndef HAVE_POLL
|
||||
int connected;
|
||||
#endif
|
||||
#if APR_HAVE_SOCKADDR_UN
|
||||
int bound;
|
||||
#endif
|
||||
int local_port_unknown;
|
||||
int local_interface_unknown;
|
||||
int remote_addr_unknown;
|
||||
apr_int32_t options;
|
||||
apr_int32_t inherit;
|
||||
sock_userdata_t *userdata;
|
||||
#ifndef WAITIO_USES_POLL
|
||||
/* if there is a timeout set, then this pollset is used */
|
||||
apr_pollset_t *pollset;
|
||||
#endif
|
||||
};
|
||||
|
||||
const char *apr_inet_ntop(int af, const void *src, char *dst, apr_size_t size);
|
||||
int apr_inet_pton(int af, const char *src, void *dst);
|
||||
void apr_sockaddr_vars_set(apr_sockaddr_t *, int, apr_port_t);
|
||||
|
||||
#define apr_is_option_set(skt, option) \
|
||||
(((skt)->options & (option)) == (option))
|
||||
|
||||
#define apr_set_option(skt, option, on) \
|
||||
do { \
|
||||
if (on) \
|
||||
(skt)->options |= (option); \
|
||||
else \
|
||||
(skt)->options &= ~(option); \
|
||||
} while (0)
|
||||
|
||||
#endif /* ! NETWORK_IO_H */
|
||||
|
||||
@@ -0,0 +1,189 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_ARCH_POLL_PRIVATE_H
|
||||
#define APR_ARCH_POLL_PRIVATE_H
|
||||
|
||||
#if HAVE_POLL_H
|
||||
#include <poll.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_SYS_POLL_H
|
||||
#include <sys/poll.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PORT_CREATE
|
||||
#include <port.h>
|
||||
#include <sys/port_impl.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_KQUEUE
|
||||
#include <sys/types.h>
|
||||
#include <sys/event.h>
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_EPOLL
|
||||
#include <sys/epoll.h>
|
||||
#endif
|
||||
|
||||
#ifdef NETWARE
|
||||
#define HAS_SOCKETS(dt) (dt == APR_POLL_SOCKET) ? 1 : 0
|
||||
#define HAS_PIPES(dt) (dt == APR_POLL_FILE) ? 1 : 0
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_AIO_H) && defined(HAVE_AIO_MSGQ)
|
||||
#define _AIO_OS390 /* enable a bunch of z/OS aio.h definitions */
|
||||
#include <aio.h> /* aiocb */
|
||||
#endif
|
||||
|
||||
/* Choose the best method platform specific to use in apr_pollset */
|
||||
#ifdef HAVE_KQUEUE
|
||||
#define POLLSET_USES_KQUEUE
|
||||
#define POLLSET_DEFAULT_METHOD APR_POLLSET_KQUEUE
|
||||
#elif defined(HAVE_PORT_CREATE)
|
||||
#define POLLSET_USES_PORT
|
||||
#define POLLSET_DEFAULT_METHOD APR_POLLSET_PORT
|
||||
#elif defined(HAVE_EPOLL)
|
||||
#define POLLSET_USES_EPOLL
|
||||
#define POLLSET_DEFAULT_METHOD APR_POLLSET_EPOLL
|
||||
#elif defined(HAVE_AIO_MSGQ)
|
||||
#define POLLSET_USES_AIO_MSGQ
|
||||
#define POLLSET_DEFAULT_METHOD APR_POLLSET_AIO_MSGQ
|
||||
#elif defined(HAVE_POLL)
|
||||
#define POLLSET_USES_POLL
|
||||
#define POLLSET_DEFAULT_METHOD APR_POLLSET_POLL
|
||||
#else
|
||||
#define POLLSET_USES_SELECT
|
||||
#define POLLSET_DEFAULT_METHOD APR_POLLSET_SELECT
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#define POLL_USES_SELECT
|
||||
#undef POLLSET_DEFAULT_METHOD
|
||||
#define POLLSET_DEFAULT_METHOD APR_POLLSET_SELECT
|
||||
#else
|
||||
#ifdef HAVE_POLL
|
||||
#define POLL_USES_POLL
|
||||
#else
|
||||
#define POLL_USES_SELECT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(POLLSET_USES_KQUEUE) || defined(POLLSET_USES_EPOLL) || defined(POLLSET_USES_PORT) || defined(POLLSET_USES_AIO_MSGQ)
|
||||
|
||||
#include "apr_ring.h"
|
||||
|
||||
#if APR_HAS_THREADS
|
||||
#include "apr_thread_mutex.h"
|
||||
#define pollset_lock_rings() \
|
||||
if (pollset->flags & APR_POLLSET_THREADSAFE) \
|
||||
apr_thread_mutex_lock(pollset->p->ring_lock);
|
||||
#define pollset_unlock_rings() \
|
||||
if (pollset->flags & APR_POLLSET_THREADSAFE) \
|
||||
apr_thread_mutex_unlock(pollset->p->ring_lock);
|
||||
#else
|
||||
#define pollset_lock_rings()
|
||||
#define pollset_unlock_rings()
|
||||
#endif
|
||||
|
||||
typedef struct pfd_elem_t pfd_elem_t;
|
||||
|
||||
struct pfd_elem_t {
|
||||
APR_RING_ENTRY(pfd_elem_t) link;
|
||||
apr_pollfd_t pfd;
|
||||
#ifdef HAVE_PORT_CREATE
|
||||
int on_query_ring;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
typedef struct apr_pollset_private_t apr_pollset_private_t;
|
||||
typedef struct apr_pollset_provider_t apr_pollset_provider_t;
|
||||
typedef struct apr_pollcb_provider_t apr_pollcb_provider_t;
|
||||
|
||||
struct apr_pollset_t
|
||||
{
|
||||
apr_pool_t *pool;
|
||||
apr_uint32_t nelts;
|
||||
apr_uint32_t nalloc;
|
||||
apr_uint32_t flags;
|
||||
/* Pipe descriptors used for wakeup */
|
||||
apr_file_t *wakeup_pipe[2];
|
||||
apr_pollfd_t wakeup_pfd;
|
||||
apr_pollset_private_t *p;
|
||||
const apr_pollset_provider_t *provider;
|
||||
};
|
||||
|
||||
typedef union {
|
||||
#if defined(HAVE_EPOLL)
|
||||
struct epoll_event *epoll;
|
||||
#endif
|
||||
#if defined(HAVE_PORT_CREATE)
|
||||
port_event_t *port;
|
||||
#endif
|
||||
#if defined(HAVE_KQUEUE)
|
||||
struct kevent *ke;
|
||||
#endif
|
||||
#if defined(HAVE_POLL)
|
||||
struct pollfd *ps;
|
||||
#endif
|
||||
void *undef;
|
||||
} apr_pollcb_pset;
|
||||
|
||||
struct apr_pollcb_t {
|
||||
apr_pool_t *pool;
|
||||
apr_uint32_t nelts;
|
||||
apr_uint32_t nalloc;
|
||||
apr_uint32_t flags;
|
||||
/* Pipe descriptors used for wakeup */
|
||||
apr_file_t *wakeup_pipe[2];
|
||||
apr_pollfd_t wakeup_pfd;
|
||||
int fd;
|
||||
apr_pollcb_pset pollset;
|
||||
apr_pollfd_t **copyset;
|
||||
const apr_pollcb_provider_t *provider;
|
||||
};
|
||||
|
||||
struct apr_pollset_provider_t {
|
||||
apr_status_t (*create)(apr_pollset_t *, apr_uint32_t, apr_pool_t *, apr_uint32_t);
|
||||
apr_status_t (*add)(apr_pollset_t *, const apr_pollfd_t *);
|
||||
apr_status_t (*remove)(apr_pollset_t *, const apr_pollfd_t *);
|
||||
apr_status_t (*poll)(apr_pollset_t *, apr_interval_time_t, apr_int32_t *, const apr_pollfd_t **);
|
||||
apr_status_t (*cleanup)(apr_pollset_t *);
|
||||
const char *name;
|
||||
};
|
||||
|
||||
struct apr_pollcb_provider_t {
|
||||
apr_status_t (*create)(apr_pollcb_t *, apr_uint32_t, apr_pool_t *, apr_uint32_t);
|
||||
apr_status_t (*add)(apr_pollcb_t *, apr_pollfd_t *);
|
||||
apr_status_t (*remove)(apr_pollcb_t *, apr_pollfd_t *);
|
||||
apr_status_t (*poll)(apr_pollcb_t *, apr_interval_time_t, apr_pollcb_cb_t, void *);
|
||||
apr_status_t (*cleanup)(apr_pollcb_t *);
|
||||
const char *name;
|
||||
};
|
||||
|
||||
/*
|
||||
* Private functions used for the implementation of both apr_pollcb_* and
|
||||
* apr_pollset_*
|
||||
*/
|
||||
apr_status_t apr_poll_create_wakeup_pipe(apr_pool_t *pool, apr_pollfd_t *pfd,
|
||||
apr_file_t **wakeup_pipe);
|
||||
apr_status_t apr_poll_close_wakeup_pipe(apr_file_t **wakeup_pipe);
|
||||
void apr_poll_drain_wakeup_pipe(apr_file_t **wakeup_pipe);
|
||||
|
||||
#endif /* APR_ARCH_POLL_PRIVATE_H */
|
||||
@@ -0,0 +1,119 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef PROC_MUTEX_H
|
||||
#define PROC_MUTEX_H
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_private.h"
|
||||
#include "apr_general.h"
|
||||
#include "apr_lib.h"
|
||||
#include "apr_proc_mutex.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_portable.h"
|
||||
#include "apr_file_io.h"
|
||||
#include "apr_arch_file_io.h"
|
||||
|
||||
/* System headers required by Locks library */
|
||||
#if APR_HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#if APR_HAVE_STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#if APR_HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_IPC_H
|
||||
#include <sys/ipc.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SEM_H
|
||||
#include <sys/sem.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_FILE_H
|
||||
#include <sys/file.h>
|
||||
#endif
|
||||
#if APR_HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#if APR_HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#if APR_HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_MMAN_H
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
#if APR_HAVE_PTHREAD_H
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
/* End System Headers */
|
||||
|
||||
struct apr_proc_mutex_unix_lock_methods_t {
|
||||
unsigned int flags;
|
||||
apr_status_t (*create)(apr_proc_mutex_t *, const char *);
|
||||
apr_status_t (*acquire)(apr_proc_mutex_t *);
|
||||
apr_status_t (*tryacquire)(apr_proc_mutex_t *);
|
||||
apr_status_t (*release)(apr_proc_mutex_t *);
|
||||
apr_status_t (*cleanup)(void *);
|
||||
apr_status_t (*child_init)(apr_proc_mutex_t **, apr_pool_t *, const char *);
|
||||
apr_status_t (*perms_set)(apr_proc_mutex_t *, apr_fileperms_t, apr_uid_t, apr_gid_t);
|
||||
apr_lockmech_e mech;
|
||||
const char *name;
|
||||
};
|
||||
typedef struct apr_proc_mutex_unix_lock_methods_t apr_proc_mutex_unix_lock_methods_t;
|
||||
|
||||
/* bit values for flags field in apr_unix_lock_methods_t */
|
||||
#define APR_PROCESS_LOCK_MECH_IS_GLOBAL 1
|
||||
|
||||
#if !APR_HAVE_UNION_SEMUN && defined(APR_HAS_SYSVSEM_SERIALIZE)
|
||||
union semun {
|
||||
int val;
|
||||
struct semid_ds *buf;
|
||||
unsigned short *array;
|
||||
};
|
||||
#endif
|
||||
|
||||
struct apr_proc_mutex_t {
|
||||
apr_pool_t *pool;
|
||||
const apr_proc_mutex_unix_lock_methods_t *meth;
|
||||
int curr_locked;
|
||||
char *fname;
|
||||
|
||||
apr_os_proc_mutex_t os; /* Native mutex holder. */
|
||||
|
||||
#if APR_HAS_FCNTL_SERIALIZE || APR_HAS_FLOCK_SERIALIZE
|
||||
apr_file_t *interproc; /* For apr_file_ calls on native fd. */
|
||||
int interproc_closing; /* whether the native fd is opened/closed with
|
||||
* 'interproc' or apr_os_file_put()ed (hence
|
||||
* needing an an explicit close for consistency
|
||||
* with other methods).
|
||||
*/
|
||||
#endif
|
||||
#if APR_HAS_PROC_PTHREAD_SERIALIZE
|
||||
int pthread_refcounting; /* Whether the native mutex is refcounted or
|
||||
* apr_os_proc_mutex_put()ed, which makes
|
||||
* refcounting impossible/undesirable.
|
||||
*/
|
||||
#endif
|
||||
};
|
||||
|
||||
void apr_proc_mutex_unix_setup_lock(void);
|
||||
|
||||
#endif /* PROC_MUTEX_H */
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef SHM_H
|
||||
#define SHM_H
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_private.h"
|
||||
#include "apr_general.h"
|
||||
#include "apr_lib.h"
|
||||
#include "apr_shm.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_file_io.h"
|
||||
#include "apr_network_io.h"
|
||||
#include "apr_portable.h"
|
||||
|
||||
#if APR_HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_MMAN_H
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_IPC_H
|
||||
#include <sys/ipc.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_MUTEX_H
|
||||
#include <sys/mutex.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SHM_H
|
||||
#include <sys/shm.h>
|
||||
#endif
|
||||
#if !defined(SHM_R)
|
||||
#define SHM_R 0400
|
||||
#endif
|
||||
#if !defined(SHM_W)
|
||||
#define SHM_W 0200
|
||||
#endif
|
||||
#ifdef HAVE_SYS_FILE_H
|
||||
#include <sys/file.h>
|
||||
#endif
|
||||
|
||||
/* Not all systems seem to have MAP_FAILED defined, but it should always
|
||||
* just be (void *)-1. */
|
||||
#ifndef MAP_FAILED
|
||||
#define MAP_FAILED ((void *)-1)
|
||||
#endif
|
||||
|
||||
struct apr_shm_t {
|
||||
apr_pool_t *pool;
|
||||
void *base; /* base real address */
|
||||
void *usable; /* base usable address */
|
||||
apr_size_t reqsize; /* requested segment size */
|
||||
apr_size_t realsize; /* actual segment size */
|
||||
const char *filename; /* NULL if anonymous */
|
||||
#if APR_USE_SHMEM_SHMGET || APR_USE_SHMEM_SHMGET_ANON
|
||||
int shmid; /* shmem ID returned from shmget() */
|
||||
key_t shmkey; /* shmem key IPC_ANON or returned from ftok() */
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif /* SHM_H */
|
||||
@@ -0,0 +1,42 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef THREAD_COND_H
|
||||
#define THREAD_COND_H
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_private.h"
|
||||
#include "apr_general.h"
|
||||
#include "apr_lib.h"
|
||||
#include "apr_thread_mutex.h"
|
||||
#include "apr_thread_cond.h"
|
||||
#include "apr_pools.h"
|
||||
|
||||
#if APR_HAVE_PTHREAD_H
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
/* XXX: Should we have a better autoconf search, something like
|
||||
* APR_HAS_PTHREAD_COND? -aaron */
|
||||
#if APR_HAS_THREADS
|
||||
struct apr_thread_cond_t {
|
||||
apr_pool_t *pool;
|
||||
pthread_cond_t cond;
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif /* THREAD_COND_H */
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef THREAD_MUTEX_H
|
||||
#define THREAD_MUTEX_H
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_private.h"
|
||||
#include "apr_general.h"
|
||||
#include "apr_thread_mutex.h"
|
||||
#include "apr_portable.h"
|
||||
#include "apr_atomic.h"
|
||||
|
||||
#if APR_HAVE_PTHREAD_H
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
#if APR_HAS_THREADS
|
||||
struct apr_thread_mutex_t {
|
||||
apr_pool_t *pool;
|
||||
pthread_mutex_t mutex;
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif /* THREAD_MUTEX_H */
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef THREAD_RWLOCK_H
|
||||
#define THREAD_RWLOCK_H
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_private.h"
|
||||
#include "apr_general.h"
|
||||
#include "apr_thread_rwlock.h"
|
||||
#include "apr_pools.h"
|
||||
|
||||
#if APR_HAVE_PTHREAD_H
|
||||
/* this gives us pthread_rwlock_t */
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
#if APR_HAS_THREADS
|
||||
#ifdef HAVE_PTHREAD_RWLOCKS
|
||||
|
||||
struct apr_thread_rwlock_t {
|
||||
apr_pool_t *pool;
|
||||
pthread_rwlock_t rwlock;
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
struct apr_thread_rwlock_t {
|
||||
apr_pool_t *pool;
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* THREAD_RWLOCK_H */
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_private.h"
|
||||
#include "apr_thread_proc.h"
|
||||
#include "apr_file_io.h"
|
||||
#include "apr_arch_file_io.h"
|
||||
#include "apr_perms_set.h"
|
||||
|
||||
/* System headers required for thread/process library */
|
||||
#if APR_HAVE_PTHREAD_H
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_RESOURCE_H
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
#if APR_HAVE_SIGNAL_H
|
||||
#include <signal.h>
|
||||
#endif
|
||||
#if APR_HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#if APR_HAVE_SYS_WAIT_H
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
#if APR_HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_SCHED_H
|
||||
#include <sched.h>
|
||||
#endif
|
||||
/* End System Headers */
|
||||
|
||||
|
||||
#ifndef THREAD_PROC_H
|
||||
#define THREAD_PROC_H
|
||||
|
||||
#define SHELL_PATH "/bin/sh"
|
||||
|
||||
#if APR_HAS_THREADS
|
||||
|
||||
struct apr_thread_t {
|
||||
apr_pool_t *pool;
|
||||
pthread_t *td;
|
||||
void *data;
|
||||
apr_thread_start_t func;
|
||||
apr_status_t exitval;
|
||||
};
|
||||
|
||||
struct apr_threadattr_t {
|
||||
apr_pool_t *pool;
|
||||
pthread_attr_t attr;
|
||||
};
|
||||
|
||||
struct apr_threadkey_t {
|
||||
apr_pool_t *pool;
|
||||
pthread_key_t key;
|
||||
};
|
||||
|
||||
struct apr_thread_once_t {
|
||||
pthread_once_t once;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
typedef struct apr_procattr_pscb_t apr_procattr_pscb_t;
|
||||
struct apr_procattr_pscb_t {
|
||||
struct apr_procattr_pscb_t *next;
|
||||
apr_perms_setfn_t *perms_set_fn;
|
||||
apr_fileperms_t perms;
|
||||
const void *data;
|
||||
};
|
||||
|
||||
struct apr_procattr_t {
|
||||
apr_pool_t *pool;
|
||||
apr_file_t *parent_in;
|
||||
apr_file_t *child_in;
|
||||
apr_file_t *parent_out;
|
||||
apr_file_t *child_out;
|
||||
apr_file_t *parent_err;
|
||||
apr_file_t *child_err;
|
||||
char *currdir;
|
||||
apr_int32_t cmdtype;
|
||||
apr_int32_t detached;
|
||||
#ifdef RLIMIT_CPU
|
||||
struct rlimit *limit_cpu;
|
||||
#endif
|
||||
#if defined (RLIMIT_DATA) || defined (RLIMIT_VMEM) || defined(RLIMIT_AS)
|
||||
struct rlimit *limit_mem;
|
||||
#endif
|
||||
#ifdef RLIMIT_NPROC
|
||||
struct rlimit *limit_nproc;
|
||||
#endif
|
||||
#ifdef RLIMIT_NOFILE
|
||||
struct rlimit *limit_nofile;
|
||||
#endif
|
||||
apr_child_errfn_t *errfn;
|
||||
apr_int32_t errchk;
|
||||
apr_uid_t uid;
|
||||
apr_gid_t gid;
|
||||
apr_procattr_pscb_t *perms_set_callbacks;
|
||||
};
|
||||
|
||||
#endif /* ! THREAD_PROC_H */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user