diff options
Diffstat (limited to 'usr/src/lib')
-rw-r--r-- | usr/src/lib/libc/port/gen/err.c | 126 | ||||
-rw-r--r-- | usr/src/lib/libc/port/mapfile-vers | 10 |
2 files changed, 95 insertions, 41 deletions
diff --git a/usr/src/lib/libc/port/gen/err.c b/usr/src/lib/libc/port/gen/err.c index 31c5a7e559..7cf6ef8105 100644 --- a/usr/src/lib/libc/port/gen/err.c +++ b/usr/src/lib/libc/port/gen/err.c @@ -23,6 +23,10 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. */ +/* + * Copyright 2022 OmniOS Community Edition (OmniOSce) Association. + */ + #include "lint.h" #include "file64.h" #include "mtlib.h" @@ -111,85 +115,71 @@ warnfinish(FILE *fp, rmutex_t *lk) FUNLOCKFILE(lk); } -void -_vwarnxfp(FILE *fp, const char *fmt, va_list args) +static void +vwarnfp(FILE *fp, int code, const char *fmt, va_list args) { rmutex_t *lk; lk = warncore(fp, fmt, args); + if (fmt != NULL) { + (void) fputc(':', fp); + (void) fputc(' ', fp); + } + (void) fputs(strerror(code), fp); warnfinish(fp, lk); } void vwarnx(const char *fmt, va_list args) { - _vwarnxfp(stderr, fmt, args); -} - -void -_vwarnfp(FILE *fp, const char *fmt, va_list args) -{ - int tmperr = errno; /* Capture errno now. */ rmutex_t *lk; - lk = warncore(fp, fmt, args); - if (fmt != NULL) { - (void) fputc(':', fp); - (void) fputc(' ', fp); - } - (void) fputs(strerror(tmperr), fp); - warnfinish(fp, lk); + lk = warncore(stderr, fmt, args); + warnfinish(stderr, lk); } void vwarn(const char *fmt, va_list args) { - _vwarnfp(stderr, fmt, args); + vwarnfp(stderr, errno, fmt, args); } -/* PRINTFLIKE1 */ void -warnx(const char *fmt, ...) +vwarnc(int code, const char *fmt, va_list args) { - va_list args; - - va_start(args, fmt); - vwarnx(fmt, args); - va_end(args); + vwarnfp(stderr, code, fmt, args); } void -_warnfp(FILE *fp, const char *fmt, ...) +warnx(const char *fmt, ...) { va_list args; va_start(args, fmt); - _vwarnfp(fp, fmt, args); + vwarnx(fmt, args); va_end(args); } void -_warnxfp(FILE *fp, const char *fmt, ...) +warn(const char *fmt, ...) { va_list args; va_start(args, fmt); - _vwarnxfp(fp, fmt, args); + vwarn(fmt, args); va_end(args); } -/* PRINTFLIKE1 */ void -warn(const char *fmt, ...) +warnc(int code, const char *fmt, ...) { va_list args; va_start(args, fmt); - vwarn(fmt, args); + vwarnc(code, fmt, args); va_end(args); } -/* PRINTFLIKE2 */ void err(int status, const char *fmt, ...) { @@ -202,12 +192,12 @@ err(int status, const char *fmt, ...) } void -_errfp(FILE *fp, int status, const char *fmt, ...) +errc(int status, int code, const char *fmt, ...) { va_list args; va_start(args, fmt); - _vwarnfp(fp, fmt, args); + vwarnc(code, fmt, args); va_end(args); exit(status); } @@ -220,13 +210,12 @@ verr(int status, const char *fmt, va_list args) } void -_verrfp(FILE *fp, int status, const char *fmt, va_list args) +verrc(int status, int code, const char *fmt, va_list args) { - _vwarnfp(fp, fmt, args); + vwarnc(code, fmt, args); exit(status); } -/* PRINTFLIKE2 */ void errx(int status, const char *fmt, ...) { @@ -239,20 +228,77 @@ errx(int status, const char *fmt, ...) } void -_errxfp(FILE *fp, int status, const char *fmt, ...) +verrx(int status, const char *fmt, va_list args) +{ + vwarnx(fmt, args); + exit(status); +} + +/* + * The following functions are here as the targets of filters in libipsecutil. + */ + +void +_vwarnxfp(FILE *fp, const char *fmt, va_list args) +{ + rmutex_t *lk; + + lk = warncore(fp, fmt, args); + warnfinish(fp, lk); +} + +void +_vwarnfp(FILE *fp, const char *fmt, va_list args) +{ + vwarnfp(fp, errno, fmt, args); +} + +void +_warnfp(FILE *fp, const char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + _vwarnfp(fp, fmt, args); + va_end(args); +} + +void +_warnxfp(FILE *fp, const char *fmt, ...) { va_list args; va_start(args, fmt); _vwarnxfp(fp, fmt, args); va_end(args); +} + +void +_errfp(FILE *fp, int status, const char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + _vwarnfp(fp, fmt, args); + va_end(args); exit(status); } void -verrx(int status, const char *fmt, va_list args) +_verrfp(FILE *fp, int status, const char *fmt, va_list args) { - vwarnx(fmt, args); + _vwarnfp(fp, fmt, args); + exit(status); +} + +void +_errxfp(FILE *fp, int status, const char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + _vwarnxfp(fp, fmt, args); + va_end(args); exit(status); } diff --git a/usr/src/lib/libc/port/mapfile-vers b/usr/src/lib/libc/port/mapfile-vers index 46f3fa5f07..9ccd7c528e 100644 --- a/usr/src/lib/libc/port/mapfile-vers +++ b/usr/src/lib/libc/port/mapfile-vers @@ -27,7 +27,7 @@ # Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved. # Copyright (c) 2013 Gary Mills # Copyright 2014 Garrett D'Amore <garrett@damore.org> -# Copyright 2020 OmniOS Community Edition (OmniOSce) Association. +# Copyright 2022 OmniOS Community Edition (OmniOSce) Association. # # @@ -78,6 +78,14 @@ $if _x86 && _ELF64 $add amd64 $endif +SYMBOL_VERSION ILLUMOS_0.40 { + protected: + errc; + verrc; + vwarnc; + warnc; +} ILLUMOS_0.39; + SYMBOL_VERSION ILLUMOS_0.39 { protected: memrchr; |