2021-11-25 16:44:06 +08:00
|
|
|
/****************************************************************************
|
|
|
|
* include/err.h
|
|
|
|
*
|
2024-10-02 21:59:15 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
2021-11-25 16:44:06 +08:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __INCLUDE_ERR_H
|
|
|
|
#define __INCLUDE_ERR_H
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <nuttx/compiler.h>
|
|
|
|
|
2022-08-08 02:22:10 +08:00
|
|
|
/****************************************************************************
|
|
|
|
* Pre-processor Definitions
|
|
|
|
****************************************************************************/
|
|
|
|
|
2023-04-28 08:01:46 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
#define EXTERN extern "C"
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#else
|
|
|
|
#define EXTERN extern
|
|
|
|
#endif
|
|
|
|
|
2022-08-08 02:22:10 +08:00
|
|
|
/* Append _func suffix to avoid the penitential symbol collision */
|
|
|
|
|
|
|
|
#define warn warn_func
|
|
|
|
#define vwarn vwarn_func
|
|
|
|
#define warnx warnx_func
|
|
|
|
#define vwarnx vwarnx_func
|
|
|
|
|
|
|
|
#define err err_func
|
|
|
|
#define verr verr_func
|
|
|
|
#define errx errx_func
|
|
|
|
#define verrx verrx_func
|
|
|
|
|
2021-11-25 16:44:06 +08:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Function Prototypes
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/* Print "pid: ", FORMAT, ": ", the standard error string for errno,
|
|
|
|
* and a newline, on stderr.
|
|
|
|
*/
|
|
|
|
|
2022-12-12 15:43:47 +08:00
|
|
|
void warn(FAR const char *fmt, ...) printf_like(1, 2);
|
|
|
|
void vwarn(FAR const char *fmt, va_list ap) printf_like(1, 0);
|
2021-11-25 16:44:06 +08:00
|
|
|
|
|
|
|
/* Likewise, but without ": " and the standard error string. */
|
|
|
|
|
2022-12-12 15:43:47 +08:00
|
|
|
void warnx(FAR const char *fmt, ...) printf_like(1, 2);
|
|
|
|
void vwarnx(FAR const char *fmt, va_list ap) printf_like(1, 0);
|
2021-11-25 16:44:06 +08:00
|
|
|
|
|
|
|
/* Likewise, and then exit with STATUS. */
|
|
|
|
|
2022-12-12 15:43:47 +08:00
|
|
|
void err(int status, FAR const char *fmt, ...) printf_like(2, 3);
|
|
|
|
void verr(int status, FAR const char *fmt, va_list ap) printf_like(2, 0);
|
|
|
|
void errx(int status, FAR const char *fmt, ...) printf_like(2, 3);
|
2022-12-21 07:10:29 +08:00
|
|
|
void verrx(int status, FAR const char *fmt, va_list ap) printf_like(2, 0);
|
2021-11-25 16:44:06 +08:00
|
|
|
|
2023-04-28 08:01:46 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
#undef EXTERN
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2021-11-25 16:44:06 +08:00
|
|
|
#endif /* __INCLUDE_ERR_H */
|