@@ -282,7 +282,7 @@ static void send_to_all(const char *fmt, ...)
282
282
283
283
result = WriteFile (conn -> fd , buf , buflen , & bytesWritten , NULL );
284
284
if ( result == 0 ) {
285
- upsdebugx (2 , "write failed on handle %p, disconnecting" , conn -> fd );
285
+ upsdebugx (2 , "%s: write failed on handle %p, disconnecting" , __func__ , conn -> fd );
286
286
sock_disconnect (conn );
287
287
continue ;
288
288
}
@@ -301,7 +301,7 @@ static void send_to_all(const char *fmt, ...)
301
301
"handle %p failed (ret=%" PRIiSIZE "), disconnecting: %s" ,
302
302
__func__ , buflen , conn -> fd , ret , strerror (errno ));
303
303
#endif
304
- upsdebugx (6 , "failed write: %s" , buf );
304
+ upsdebugx (6 , "%s: failed write: %s" , __func__ , buf );
305
305
306
306
sock_disconnect (conn );
307
307
@@ -427,7 +427,7 @@ static int send_to_one(conn_t *conn, const char *fmt, ...)
427
427
"handle %p failed (ret=%" PRIiSIZE "), disconnecting: %s" ,
428
428
__func__ , buflen , conn -> fd , ret , strerror (errno ));
429
429
#endif
430
- upsdebugx (6 , "failed write: %s" , buf );
430
+ upsdebugx (6 , "%s: failed write: %s" , __func__ , buf );
431
431
sock_disconnect (conn );
432
432
433
433
/* TOTHINK: Maybe fallback elsewhere in other cases? */
@@ -475,7 +475,7 @@ static void sock_connect(TYPE_FD sock)
475
475
fd = accept (sock , (struct sockaddr * ) & sa , & salen );
476
476
477
477
if (INVALID_FD (fd )) {
478
- upslog_with_errno (LOG_ERR , "accept on unix fd failed" );
478
+ upslog_with_errno (LOG_ERR , "%s: accept on unix fd failed" , __func__ );
479
479
return ;
480
480
}
481
481
@@ -491,15 +491,15 @@ static void sock_connect(TYPE_FD sock)
491
491
ret = fcntl (fd , F_GETFL , 0 );
492
492
493
493
if (ret < 0 ) {
494
- upslog_with_errno (LOG_ERR , "fcntl get on unix fd failed" );
494
+ upslog_with_errno (LOG_ERR , "%s: fcntl get on unix fd failed" , __func__ );
495
495
close (fd );
496
496
return ;
497
497
}
498
498
499
499
ret = fcntl (fd , F_SETFL , ret | O_NDELAY );
500
500
501
501
if (ret < 0 ) {
502
- upslog_with_errno (LOG_ERR , "fcntl set O_NDELAY on unix fd failed" );
502
+ upslog_with_errno (LOG_ERR , "%s: fcntl set O_NDELAY on unix fd failed" , __func__ );
503
503
close (fd );
504
504
return ;
505
505
}
@@ -581,9 +581,9 @@ static void sock_connect(TYPE_FD sock)
581
581
connhead = conn ;
582
582
583
583
#ifndef WIN32
584
- upsdebugx (3 , "new connection on fd %d" , fd );
584
+ upsdebugx (3 , "%s: new connection on fd %d" , __func__ , fd );
585
585
#else
586
- upsdebugx (3 , "new connection on handle %p" , sock );
586
+ upsdebugx (3 , "%s: new connection on handle %p" , __func__ , sock );
587
587
#endif
588
588
589
589
}
@@ -685,8 +685,8 @@ static int sock_arg(conn_t *conn, size_t numarg, char **arg)
685
685
char * sockfn = pipename ; /* Just for the report below; not a global var in WIN32 builds */
686
686
#endif
687
687
688
- upsdebugx (6 , "Driver on %s is now handling %s with %" PRIuSIZE " args" ,
689
- sockfn , numarg ? arg [0 ] : "<skipped: no command>" , numarg );
688
+ upsdebugx (6 , "%s: Driver on %s is now handling %s with %" PRIuSIZE " args" ,
689
+ __func__ , sockfn , numarg ? arg [0 ] : "<skipped: no command>" , numarg );
690
690
691
691
if (numarg < 1 ) {
692
692
return 0 ;
@@ -1037,9 +1037,9 @@ char * dstate_init(const char *prog, const char *devname)
1037
1037
sockfd = sock_open (sockname );
1038
1038
1039
1039
#ifndef WIN32
1040
- upsdebugx (2 , "dstate_init : sock %s open on fd %d" , sockname , sockfd );
1040
+ upsdebugx (2 , "%s : sock %s open on fd %d" , __func__ , sockname , sockfd );
1041
1041
#else
1042
- upsdebugx (2 , "dstate_init : sock %s open on handle %p" , sockname , sockfd );
1042
+ upsdebugx (2 , "%s : sock %s open on handle %p" , __func__ , sockname , sockfd );
1043
1043
#endif
1044
1044
1045
1045
/* NOTE: Caller must free this string */
@@ -1112,7 +1112,7 @@ int dstate_poll_fds(struct timeval timeout, TYPE_FD arg_extrafd)
1112
1112
break ;
1113
1113
1114
1114
default :
1115
- upslog_with_errno (LOG_ERR , "select unix sockets failed" );
1115
+ upslog_with_errno (LOG_ERR , "%s: select unix sockets failed" , __func__ );
1116
1116
}
1117
1117
1118
1118
return overrun ;
@@ -1189,7 +1189,7 @@ int dstate_poll_fds(struct timeval timeout, TYPE_FD arg_extrafd)
1189
1189
}
1190
1190
1191
1191
if (ret == WAIT_FAILED ) {
1192
- upslog_with_errno (LOG_ERR , "waitfor failed" );
1192
+ upslog_with_errno (LOG_ERR , "%s: waitfor failed" , __func__ );
1193
1193
return overrun ;
1194
1194
}
1195
1195
@@ -1390,7 +1390,7 @@ void dstate_setaux(const char *var, long aux)
1390
1390
sttmp = state_tree_find (dtree_root , var );
1391
1391
1392
1392
if (!sttmp ) {
1393
- upslogx (LOG_ERR , "dstate_setaux : base variable (%s) does not exist" , var );
1393
+ upslogx (LOG_ERR , "%s : base variable (%s) does not exist" , __func__ , var );
1394
1394
return ;
1395
1395
}
1396
1396
0 commit comments