Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
|
Macros | |
#define | CBPRINTF_PACKAGE_CONVERT_RO_STR BIT(0) |
Append read-only strings from source package to destination package. | |
#define | CBPRINTF_PACKAGE_CONVERT_RW_STR BIT(1) |
Append read-write strings from source package to destination package. | |
#define | CBPRINTF_PACKAGE_CONVERT_KEEP_RO_STR BIT(2) |
Keep read-only location indexes in the package. | |
#define | CBPRINTF_PACKAGE_CONVERT_PTR_CHECK BIT(3) |
Check format string if p argument was treated as s in the package. | |
#define CBPRINTF_PACKAGE_CONVERT_KEEP_RO_STR BIT(2) |
#include <zephyr/sys/cbprintf.h>
Keep read-only location indexes in the package.
If it is set read-only string pointers are kept in the package after copy. If not set they are discarded.
#define CBPRINTF_PACKAGE_CONVERT_PTR_CHECK BIT(3) |
#include <zephyr/sys/cbprintf.h>
Check format string if p argument was treated as s in the package.
Static packaging is done based only on types of arguments used for a format string. Without looking into format specifiers present in the string. Because of that if (unsigned) char pointer is used for p it will be considered as a string location and during conversion an attempt to append a string to a package may be performed. This can lead to misbehavior, in the best case package will be bigger and in the worst case memory fault or security violation may occur.
When this flag is set, format string will be checked to detect cases when string candidate is a pointer used for p and string appending from unexpected location is avoided. Additionally, an log warning is generated to encourage user to cast such argument to void *. It is recommended because there are configurations where string is not accessible and inspection cannot be done. In those cases there are no means to detect such cases.
#define CBPRINTF_PACKAGE_CONVERT_RO_STR BIT(0) |
#include <zephyr/sys/cbprintf.h>
Append read-only strings from source package to destination package.
If package was created with CBPRINTF_PACKAGE_ADD_RO_STR_POS or CBPRINTF_PACKAGE_ADD_RW_STR_POS it contains arrays of indexes where string address can be found in the package. When flag is set, read-only strings are copied into destination package. Address of strings indicated as read-write are also checked and if determined to be read-only they are also copied.
#define CBPRINTF_PACKAGE_CONVERT_RW_STR BIT(1) |
#include <zephyr/sys/cbprintf.h>
Append read-write strings from source package to destination package.
If package was created with CBPRINTF_PACKAGE_ADD_RW_STR_POS it contains arrays of indexes where string address can be found in the package. When flag is set, list of read-write strings is examined and if they are not determined to be read-only, they are copied into the destination package. If CBPRINTF_PACKAGE_CONVERT_RO_STR is not set, remaining string locations are considered as pointing to read-only location and they are copy to the package if CBPRINTF_PACKAGE_CONVERT_KEEP_RO_STR is set.