mirror of
https://github.com/opnsense/src.git
synced 2026-06-13 10:40:19 -04:00
libiscsiutil: Add log_warnc() and log_errc() functions
These are similar to warnc() and errc() in that they take an explicit error code instead of using the value of the errno global. Reviewed by: mav, asomers Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D48648
This commit is contained in:
parent
a55197c322
commit
de3deff65c
2 changed files with 26 additions and 0 deletions
|
|
@ -162,9 +162,13 @@ void log_set_peer_name(const char *name);
|
|||
void log_set_peer_addr(const char *addr);
|
||||
void log_err(int, const char *, ...)
|
||||
__dead2 __printflike(2, 3);
|
||||
void log_errc(int, int, const char *, ...)
|
||||
__dead2 __printflike(3, 4);
|
||||
void log_errx(int, const char *, ...)
|
||||
__dead2 __printflike(2, 3);
|
||||
void log_warn(const char *, ...) __printflike(1, 2);
|
||||
void log_warnc(int, const char *, ...)
|
||||
__printflike(2, 3);
|
||||
void log_warnx(const char *, ...) __printflike(1, 2);
|
||||
void log_debugx(const char *, ...) __printflike(1, 2);
|
||||
|
||||
|
|
|
|||
|
|
@ -152,6 +152,18 @@ log_err(int eval, const char *fmt, ...)
|
|||
exit(eval);
|
||||
}
|
||||
|
||||
void
|
||||
log_errc(int eval, int code, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
log_common(LOG_CRIT, code, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
exit(eval);
|
||||
}
|
||||
|
||||
void
|
||||
log_errx(int eval, const char *fmt, ...)
|
||||
{
|
||||
|
|
@ -174,6 +186,16 @@ log_warn(const char *fmt, ...)
|
|||
va_end(ap);
|
||||
}
|
||||
|
||||
void
|
||||
log_warnc(int code, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
log_common(LOG_WARNING, code, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void
|
||||
log_warnx(const char *fmt, ...)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue