Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
openldap
OpenLDAP
Commits
bcb0af62
Commit
bcb0af62
authored
Apr 17, 2020
by
Howard Chu
Browse files
ITS#6745 slapd daemon: use separate emfile mutex
parent
d5e133f4
Pipeline
#156
passed with stage
in 23 minutes and 46 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
servers/slapd/daemon.c
View file @
bcb0af62
...
...
@@ -103,6 +103,7 @@ static ldap_pvt_thread_t *listener_tid;
#define DAEMON_ID(fd) (fd & slapd_daemon_mask)
static
ber_socket_t
wake_sds
[
SLAPD_MAX_DAEMON_THREADS
][
2
];
static
ldap_pvt_thread_mutex_t
emfile_mutex
;
static
int
emfile
;
static
volatile
int
waking
;
...
...
@@ -1201,6 +1202,7 @@ slapd_remove(
* the select() loop. Now that we're removing a session from our
* control, we can try to resume a dropped listener to use.
*/
ldap_pvt_thread_mutex_lock
(
&
emfile_mutex
);
if
(
emfile
&&
listening
)
{
int
i
;
for
(
i
=
0
;
slap_listeners
[
i
]
!=
NULL
;
i
++
)
{
...
...
@@ -1221,6 +1223,7 @@ slapd_remove(
*/
if
(
slap_listeners
[
i
]
==
NULL
)
emfile
=
0
;
}
ldap_pvt_thread_mutex_unlock
(
&
emfile_mutex
);
ldap_pvt_thread_mutex_unlock
(
&
slap_daemon
[
id
].
sd_mutex
);
WAKE_LISTENER
(
id
,
wake
||
slapd_gentle_shutdown
==
2
);
}
...
...
@@ -1895,6 +1898,7 @@ slapd_daemon_init( const char *urls )
#ifdef HAVE_TCPD
ldap_pvt_thread_mutex_init
(
&
sd_tcpd_mutex
);
#endif
/* TCP Wrappers */
ldap_pvt_thread_mutex_init
(
&
emfile_mutex
);
daemon_inited
=
1
;
...
...
@@ -1998,6 +2002,7 @@ slapd_daemon_destroy( void )
SLAP_SOCK_DESTROY
(
i
);
}
daemon_inited
=
0
;
ldap_pvt_thread_mutex_destroy
(
&
emfile_mutex
);
#ifdef HAVE_TCPD
ldap_pvt_thread_mutex_destroy
(
&
sd_tcpd_mutex
);
#endif
/* TCP Wrappers */
...
...
@@ -2142,11 +2147,11 @@ slap_listener(
#endif
/* ENFILE */
0
)
{
ldap_pvt_thread_mutex_lock
(
&
slap_daemon
[
0
].
sd
_mutex
);
ldap_pvt_thread_mutex_lock
(
&
emfile
_mutex
);
emfile
++
;
/* Stop listening until an existing session closes */
sl
->
sl_mute
=
1
;
ldap_pvt_thread_mutex_unlock
(
&
slap_daemon
[
0
].
sd
_mutex
);
ldap_pvt_thread_mutex_unlock
(
&
emfile
_mutex
);
}
Debug
(
LDAP_DEBUG_ANY
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment