mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-01 06:55:30 +00:00
Use isc_log_wouldlog() to avoid calling strerror() whenever possible.
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: socket.c,v 1.148 2000/07/13 00:25:38 gson Exp $ */
|
/* $Id: socket.c,v 1.149 2000/07/13 01:13:53 bwelling Exp $ */
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
@@ -76,11 +76,17 @@
|
|||||||
* DLVL(50) -- Event tracing, including receiving/sending completion events.
|
* DLVL(50) -- Event tracing, including receiving/sending completion events.
|
||||||
* DLVL(20) -- Socket creation/destruction.
|
* DLVL(20) -- Socket creation/destruction.
|
||||||
*/
|
*/
|
||||||
#define TRACE DLVL(90)
|
#define TRACE_LEVEL 90
|
||||||
#define CORRECTNESS DLVL(70)
|
#define CORRECTNESS_LEVEL 70
|
||||||
#define IOEVENT DLVL(60)
|
#define IOEVENT_LEVEL 60
|
||||||
#define EVENT DLVL(50)
|
#define EVENT_LEVEL 50
|
||||||
#define CREATION DLVL(20)
|
#define CREATION_LEVEL 20
|
||||||
|
|
||||||
|
#define TRACE DLVL(TRACE_LEVEL)
|
||||||
|
#define CORRECTNESS DLVL(CORRECTNESS_LEVEL)
|
||||||
|
#define IOEVENT DLVL(IOEVENT_LEVEL)
|
||||||
|
#define EVENT DLVL(EVENT_LEVEL)
|
||||||
|
#define CREATION DLVL(CREATION_LEVEL)
|
||||||
|
|
||||||
typedef isc_event_t intev_t;
|
typedef isc_event_t intev_t;
|
||||||
|
|
||||||
@@ -744,6 +750,7 @@ doio_recv(isc_socket_t *sock, isc_socketevent_t *dev) {
|
|||||||
if (SOFT_ERROR(errno))
|
if (SOFT_ERROR(errno))
|
||||||
return (DOIO_SOFT);
|
return (DOIO_SOFT);
|
||||||
|
|
||||||
|
if (isc_log_wouldlog(isc_lctx, IOEVENT_LEVEL))
|
||||||
socket_log(sock, NULL, IOEVENT,
|
socket_log(sock, NULL, IOEVENT,
|
||||||
"doio_recv: recvmsg(%d) %d bytes, err %d/%s",
|
"doio_recv: recvmsg(%d) %d bytes, err %d/%s",
|
||||||
sock->fd, cc, errno, strerror(errno));
|
sock->fd, cc, errno, strerror(errno));
|
||||||
@@ -1521,8 +1528,10 @@ internal_accept(isc_task_t *me, isc_event_t *ev) {
|
|||||||
* If some other error, ignore it as well and hope
|
* If some other error, ignore it as well and hope
|
||||||
* for the best, but log it.
|
* for the best, but log it.
|
||||||
*/
|
*/
|
||||||
|
if (isc_log_wouldlog(isc_lctx, TRACE_LEVEL))
|
||||||
socket_log(sock, NULL, TRACE,
|
socket_log(sock, NULL, TRACE,
|
||||||
"accept() returned %d/%s", errno, strerror(errno));
|
"accept() returned %d/%s", errno,
|
||||||
|
strerror(errno));
|
||||||
|
|
||||||
fd = -1;
|
fd = -1;
|
||||||
|
|
||||||
@@ -1802,8 +1811,10 @@ watcher(void *uap) {
|
|||||||
UNLOCK(&manager->lock);
|
UNLOCK(&manager->lock);
|
||||||
|
|
||||||
cc = select(maxfd, &readfds, &writefds, NULL, NULL);
|
cc = select(maxfd, &readfds, &writefds, NULL, NULL);
|
||||||
|
if (isc_log_wouldlog(isc_lctx, IOEVENT_LEVEL))
|
||||||
manager_log(manager, IOEVENT,
|
manager_log(manager, IOEVENT,
|
||||||
"select(%d, ...) == %d, errno %d/%s",
|
"select(%d, ...) == %d, "
|
||||||
|
"errno %d/%s",
|
||||||
maxfd, cc, errno, strerror(errno));
|
maxfd, cc, errno, strerror(errno));
|
||||||
if (cc < 0) {
|
if (cc < 0) {
|
||||||
if (!SOFT_ERROR(errno))
|
if (!SOFT_ERROR(errno))
|
||||||
|
Reference in New Issue
Block a user