Deleted Added
full compact
apr_arch_proc_mutex.h (302408) apr_arch_proc_mutex.h (362181)
1/* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0

--- 12 unchanged lines hidden (view full) ---

21#include "apr_private.h"
22#include "apr_general.h"
23#include "apr_lib.h"
24#include "apr_proc_mutex.h"
25#include "apr_pools.h"
26#include "apr_portable.h"
27#include "apr_file_io.h"
28#include "apr_arch_file_io.h"
1/* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0

--- 12 unchanged lines hidden (view full) ---

21#include "apr_private.h"
22#include "apr_general.h"
23#include "apr_lib.h"
24#include "apr_proc_mutex.h"
25#include "apr_pools.h"
26#include "apr_portable.h"
27#include "apr_file_io.h"
28#include "apr_arch_file_io.h"
29#include "apr_time.h"
29
30/* System headers required by Locks library */
31#if APR_HAVE_SYS_TYPES_H
32#include <sys/types.h>
33#endif
34#if APR_HAVE_STDIO_H
35#include <stdio.h>
36#endif

--- 20 unchanged lines hidden (view full) ---

57#include <string.h>
58#endif
59#ifdef HAVE_SYS_MMAN_H
60#include <sys/mman.h>
61#endif
62#if APR_HAVE_PTHREAD_H
63#include <pthread.h>
64#endif
30
31/* System headers required by Locks library */
32#if APR_HAVE_SYS_TYPES_H
33#include <sys/types.h>
34#endif
35#if APR_HAVE_STDIO_H
36#include <stdio.h>
37#endif

--- 20 unchanged lines hidden (view full) ---

58#include <string.h>
59#endif
60#ifdef HAVE_SYS_MMAN_H
61#include <sys/mman.h>
62#endif
63#if APR_HAVE_PTHREAD_H
64#include <pthread.h>
65#endif
65#if APR_HAVE_SEMAPHORE_H
66#include <semaphore.h>
67#endif
68/* End System Headers */
69
70struct apr_proc_mutex_unix_lock_methods_t {
71 unsigned int flags;
72 apr_status_t (*create)(apr_proc_mutex_t *, const char *);
73 apr_status_t (*acquire)(apr_proc_mutex_t *);
74 apr_status_t (*tryacquire)(apr_proc_mutex_t *);
66/* End System Headers */
67
68struct apr_proc_mutex_unix_lock_methods_t {
69 unsigned int flags;
70 apr_status_t (*create)(apr_proc_mutex_t *, const char *);
71 apr_status_t (*acquire)(apr_proc_mutex_t *);
72 apr_status_t (*tryacquire)(apr_proc_mutex_t *);
73 apr_status_t (*timedacquire)(apr_proc_mutex_t *, apr_interval_time_t);
75 apr_status_t (*release)(apr_proc_mutex_t *);
76 apr_status_t (*cleanup)(void *);
77 apr_status_t (*child_init)(apr_proc_mutex_t **, apr_pool_t *, const char *);
74 apr_status_t (*release)(apr_proc_mutex_t *);
75 apr_status_t (*cleanup)(void *);
76 apr_status_t (*child_init)(apr_proc_mutex_t **, apr_pool_t *, const char *);
77 apr_status_t (*perms_set)(apr_proc_mutex_t *, apr_fileperms_t, apr_uid_t, apr_gid_t);
78 apr_lockmech_e mech;
78 const char *name;
79};
80typedef struct apr_proc_mutex_unix_lock_methods_t apr_proc_mutex_unix_lock_methods_t;
81
82/* bit values for flags field in apr_unix_lock_methods_t */
83#define APR_PROCESS_LOCK_MECH_IS_GLOBAL 1
84
85#if !APR_HAVE_UNION_SEMUN && defined(APR_HAS_SYSVSEM_SERIALIZE)
86union semun {
87 int val;
88 struct semid_ds *buf;
89 unsigned short *array;
90};
91#endif
92
93struct apr_proc_mutex_t {
94 apr_pool_t *pool;
95 const apr_proc_mutex_unix_lock_methods_t *meth;
79 const char *name;
80};
81typedef struct apr_proc_mutex_unix_lock_methods_t apr_proc_mutex_unix_lock_methods_t;
82
83/* bit values for flags field in apr_unix_lock_methods_t */
84#define APR_PROCESS_LOCK_MECH_IS_GLOBAL 1
85
86#if !APR_HAVE_UNION_SEMUN && defined(APR_HAS_SYSVSEM_SERIALIZE)
87union semun {
88 int val;
89 struct semid_ds *buf;
90 unsigned short *array;
91};
92#endif
93
94struct apr_proc_mutex_t {
95 apr_pool_t *pool;
96 const apr_proc_mutex_unix_lock_methods_t *meth;
96 const apr_proc_mutex_unix_lock_methods_t *inter_meth;
97 int curr_locked;
98 char *fname;
97 int curr_locked;
98 char *fname;
99#if APR_HAS_SYSVSEM_SERIALIZE || APR_HAS_FCNTL_SERIALIZE || APR_HAS_FLOCK_SERIALIZE
100 apr_file_t *interproc;
99
100 apr_os_proc_mutex_t os; /* Native mutex holder. */
101
102#if APR_HAS_FCNTL_SERIALIZE || APR_HAS_FLOCK_SERIALIZE
103 apr_file_t *interproc; /* For apr_file_ calls on native fd. */
104 int interproc_closing; /* whether the native fd is opened/closed with
105 * 'interproc' or apr_os_file_put()ed (hence
106 * needing an an explicit close for consistency
107 * with other methods).
108 */
101#endif
109#endif
102#if APR_HAS_POSIXSEM_SERIALIZE
103 sem_t *psem_interproc;
104#endif
105#if APR_HAS_PROC_PTHREAD_SERIALIZE
110#if APR_HAS_PROC_PTHREAD_SERIALIZE
106 pthread_mutex_t *pthread_interproc;
111 int pthread_refcounting; /* Whether the native mutex is refcounted or
112 * apr_os_proc_mutex_put()ed, which makes
113 * refcounting impossible/undesirable.
114 */
107#endif
108};
109
110void apr_proc_mutex_unix_setup_lock(void);
111
112#endif /* PROC_MUTEX_H */
113
115#endif
116};
117
118void apr_proc_mutex_unix_setup_lock(void);
119
120#endif /* PROC_MUTEX_H */
121