Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
OpenLDAP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nadezhda Ivanova
OpenLDAP
Commits
2fda53f3
Commit
2fda53f3
authored
25 years ago
by
Kurt Zeilenga
Browse files
Options
Downloads
Patches
Plain Diff
Add missing arguments to Debug() calls... and adapt nt_debug for general
use.
parent
6bd26a6a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
servers/slapd/daemon.c
+22
-8
22 additions, 8 deletions
servers/slapd/daemon.c
servers/slapd/nt_debug.c
+19
-6
19 additions, 6 deletions
servers/slapd/nt_debug.c
with
41 additions
and
14 deletions
servers/slapd/daemon.c
+
22
−
8
View file @
2fda53f3
...
...
@@ -329,6 +329,7 @@ slapd_daemon_task(
while
(
!
slapd_shutdown
)
{
ber_socket_t
i
;
int
ns
;
int
at
;
ber_socket_t
nfds
;
#define SLAPD_EBADF_LIMIT 10
int
ebadf
=
0
;
...
...
@@ -391,21 +392,31 @@ slapd_daemon_task(
ldap_pvt_thread_mutex_unlock
(
&
slap_daemon
.
sd_mutex
);
ldap_pvt_thread_mutex_lock
(
&
active_threads_mutex
);
at
=
active_threads
;
ldap_pvt_thread_mutex_unlock
(
&
active_threads_mutex
);
#if defined( HAVE_YIELDING_SELECT ) || defined( NO_THREADS )
tvp
=
NULL
;
#else
tvp
=
a
ctive_threads
?
&
zero
:
NULL
;
tvp
=
a
t
?
&
zero
:
NULL
;
#endif
Debug
(
LDAP_DEBUG_CONNS
,
"daemon: select: tcps=%d active_threads=%d tvp=%s
\n
"
,
tcps
,
a
ctive_threads
,
tcps
,
a
t
,
tvp
==
NULL
?
"NULL"
:
"zero"
);
ldap_pvt_thread_mutex_unlock
(
&
active_threads_mutex
);
switch
(
ns
=
select
(
nfds
,
&
readfds
,
&
writefds
,
0
,
tvp
))
{
switch
(
ns
=
select
(
nfds
,
&
readfds
,
#ifdef HAVE_WINSOCK
/* don't pass empty fd_set */
(
writefds
.
fd_count
>
0
?
&
writefds
:
NULL
),
#else
&
writefds
,
#endif
NULL
,
tvp
))
{
case
-
1
:
{
/* failure - try again */
#ifdef HAVE_WINSOCK
int
err
=
WSAGetLastError
();
...
...
@@ -561,10 +572,12 @@ slapd_daemon_task(
Debug
(
LDAP_DEBUG_CONNS
,
"daemon: activity on:"
,
0
,
0
,
0
);
#ifdef HAVE_WINSOCK
for
(
i
=
0
;
i
<
readfds
.
fd_count
;
i
++
)
{
Debug
(
LDAP_DEBUG_CONNS
,
" %d%s"
,
readfds
.
fd_array
[
i
],
"r"
);
Debug
(
LDAP_DEBUG_CONNS
,
" %d%s"
,
readfds
.
fd_array
[
i
],
"r"
,
0
);
}
for
(
i
=
0
;
i
<
writefds
.
fd_count
;
i
++
)
{
Debug
(
LDAP_DEBUG_CONNS
,
" %d%s"
,
writefds
.
fd_array
[
i
],
"w"
);
Debug
(
LDAP_DEBUG_CONNS
,
" %d%s"
,
writefds
.
fd_array
[
i
],
"w"
,
0
);
}
#else
for
(
i
=
0
;
i
<
nfds
;
i
++
)
{
...
...
@@ -784,7 +797,8 @@ void hit_socket()
if
(
connect
(
s
,
(
struct
sockaddr
*
)
&
bind_addr
,
sizeof
(
struct
sockaddr_in
))
==
SOCKET_ERROR
)
{
Debug
(
LDAP_DEBUG_ANY
,
"hit_socket: error on connect: %d
\n
"
,
WSAGetLastError
(),
0
);
"hit_socket: error on connect: %d
\n
"
,
WSAGetLastError
(),
0
,
0
);
/* we can probably expect some error to occur here, mostly WSAEWOULDBLOCK */
}
...
...
@@ -815,7 +829,7 @@ slap_set_shutdown( int sig )
ldap_pvt_thread_kill
(
listener_tid
,
LDAP_SIGUSR1
);
}
#else
Debug
(
LDAP_DEBUG_TRACE
,
"Shutdown %d ordered"
,
sig
,
0
);
Debug
(
LDAP_DEBUG_TRACE
,
"Shutdown %d ordered"
,
sig
,
0
,
0
);
/* trying to "hit" the socket seems to always get a */
/* EWOULDBLOCK error, so just close the listen socket to */
/* break out of the select since we're shutting down anyway */
...
...
This diff is collapsed.
Click to expand it.
servers/slapd/nt_debug.c
+
19
−
6
View file @
2fda53f3
...
...
@@ -11,14 +11,22 @@
static
FILE
*
log_file
;
void
(
Debug
)(
int
level
,
const
char
*
fmt
,
...
)
int
lutil_debug_file
(
FILE
*
file
)
{
log_file
=
log_file
;
return
0
;
}
void
(
lutil_debug
)(
int
level
,
int
debug
,
const
char
*
fmt
,
...
)
{
char
buffer
[
4096
];
va_list
vl
;
if
(
!
(
level
&
ldap_
debug
)
)
if
(
!
(
level
&
debug
)
)
return
;
#ifdef HAVE_WINSOCK
if
(
log_file
==
NULL
)
{
log_file
=
fopen
(
LDAP_RUNDIR
LDAP_DIRSEP
"slapd.log"
,
"w"
);
...
...
@@ -29,13 +37,18 @@ void (Debug)( int level, const char *fmt, ... )
if
(
log_file
==
NULL
)
return
;
}
#endif
va_start
(
vl
,
fmt
);
vsprintf
(
buffer
,
fmt
,
vl
);
fprintf
(
log_file
,
"%s"
,
buffer
);
printf
(
"%s"
,
buffer
);
vsnprintf
(
buffer
,
sizeof
(
buffer
),
fmt
,
vl
);
buffer
[
sizeof
(
buffer
)
-
1
]
=
'\0'
;
if
(
log_file
!=
NULL
)
{
fputs
(
buffer
,
log_file
);
fflush
(
log_file
);
}
fflush
(
log_file
);
puts
(
buffer
);
va_end
(
vl
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment