kernel
This commit is contained in:
parent
b59f84ee36
commit
cfab1d3ce7
83468 changed files with 37938688 additions and 0 deletions
linux-6.8.1/tools/verification/rv/src
47
linux-6.8.1/tools/verification/rv/src/utils.c
Normal file
47
linux-6.8.1/tools/verification/rv/src/utils.c
Normal file
|
@ -0,0 +1,47 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* util functions.
|
||||
*
|
||||
* Copyright (C) 2022 Red Hat Inc, Daniel Bristot de Oliveira <bristot@kernel.org>
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <utils.h>
|
||||
|
||||
int config_debug;
|
||||
|
||||
#define MAX_MSG_LENGTH 1024
|
||||
|
||||
/**
|
||||
* err_msg - print an error message to the stderr
|
||||
*/
|
||||
void err_msg(const char *fmt, ...)
|
||||
{
|
||||
char message[MAX_MSG_LENGTH];
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
vsnprintf(message, sizeof(message), fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
fprintf(stderr, "%s", message);
|
||||
}
|
||||
|
||||
/**
|
||||
* debug_msg - print a debug message to stderr if debug is set
|
||||
*/
|
||||
void debug_msg(const char *fmt, ...)
|
||||
{
|
||||
char message[MAX_MSG_LENGTH];
|
||||
va_list ap;
|
||||
|
||||
if (!config_debug)
|
||||
return;
|
||||
|
||||
va_start(ap, fmt);
|
||||
vsnprintf(message, sizeof(message), fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
fprintf(stderr, "%s", message);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue