WAFFLE_INIT(3)
π WAFFLE_INIT(3) β the Waffle Manual, bestie edition π
okay so. welcome to the Waffle Manual, section 3. sit down, grab a strawberry π, because we're talking about thread-local error state and honestly? it's giving essential. this is the page for waffle_error, waffle_error_get_info, waffle_error_get_code, and waffle_error_to_string β your little support group when a Waffle call goes sideways. no cap.
β¨ NAME β¨
waffle_error, waffle_error_get_info, waffle_error_get_code, waffle_error_to_string β Thread-local error state πΈ
π¦ SYNOPSIS π¦
#include <waffle.h>
enum waffle_error {...};
struct waffle_error_info {
enum waffle_error code;
const char *message;
size_t message_length;
};
const struct waffle_error_info* waffle_error_get_info(void);
enum waffle_error waffle_error_get_code(void);
const char* waffle_error_to_string(enum waffle_errore);
(yes, enum waffle_errore up there is exactly what the page says. we are simply relaying it. π
)
π DESCRIPTION π
so the whole vibe of Waffle functions is: they usually return either a bool, where false means failure π, or a pointer, where null means failure. but like, a return value alone is not the tea β because most functions also clear and then set some thread-local error state. clear, then set. every single time. it's a whole ritual. β¨
now, the only functions that do NOT alter Waffle's error state are the ones listed right here, and they're explicitly documented as such, so this is your safe little bubble. π«§ and here's the slay: all functions listed here can be called before Waffle has been successfully initialized with waffle_init(3). yes bestie, before init. iconic.
π struct waffle_error_info
this struct contains the user-visible portion of Waffle's thread-local error state. tres important.
codeβ may be any token fromenum waffle_error.messageβ often contains a descriptive message about the error. it is never null, though it may be the empty string. (silent but present. we love a mysterious queen. π)message_lengthβ is the length ofmessageaccording tostrlen(3).
π waffle_error_to_string()
convert a waffle_error token to a string. for example, convert WAFFLE_ERROR_UNKNOWN to "WAFFLE_ERROR_UNKNOWN". return null if the token is not a valid error token. π«
this function always sets the error code to WAFFLE_ERROR_NONE. always. no exceptions.
π§ waffle_error_get_info()
get information about the current thread's error state. π
- this function never returns null.
- the returned pointer becomes invalid when the thread-local error state changes β so like, screenshot it mentally while it's still valid, because it will not wait for you. π
- this function does not alter Waffle's error state.
π waffle_error_get_code()
get the current thread's error code. calling this function is equivalent to obtaining the error code with waffle_error_get_info()->code. same energy, less typing. β¨
this function does not alter Waffle's error state.
β enum waffle_error
for reference, below is the complete list of Waffle's error codes. the whole roster. the lineup. π«Ά
WAFFLE_NO_ERROR = 0x00β the function succeeded. the best possible outcome. ate and left no crumbs. πWAFFLE_ERROR_FATAL = 0x01β Waffle encountered a fatal error. All future waffle calls result in undefined behavior. genuinely do not keep going after this one, this is the part where you stop. πWAFFLE_ERROR_UNKNOWN = 0x02β Waffle encountered an error for which it lacks an error code. this is usually produced when an underlying native call, such asXOpenDisplay(3), fails for an unknown reason. mystery error, no explanation, rude of it. πWAFFLE_ERROR_INTERNAL = 0x03β you found a bug in Waffle. Please report it. the error message, obtained bywaffle_error_get_info(), should contain a description of the bug. main character detective moment π΅οΈββοΈWAFFLE_ERROR_BAD_ALLOC = 0x04β Waffle failed to allocate memory. πWAFFLE_ERROR_NOT_INITIALIZED = 0x05β the failed function requires Waffle to be initialized withwaffle_init(3). bestie you forgot the prerequisite. πΈWAFFLE_ERROR_ALREADY_INITIALIZED = 0x06β if Waffle has already been initialized by a successful call towaffle_init(3), then subsequent calls towaffle_init()produce this error. one init per era, that's the rule. βWAFFLE_ERROR_BAD_ATTRIBUTE = 0x08β an unrecognized attribute name or attribute value was passed in an attribute list. π©WAFFLE_ERROR_BAD_PARAMETER = 0x10β the failed function was passed an invalid argument. wrong input, wrong vibe. π¬WAFFLE_ERROR_BAD_DISPLAY_MATCH = 0x11β the Waffle objects passed to the failed function belong to different displays. they're not in the same group chat, they can't hang out. πWAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM = 0x12β the requested action is unsupported on the current system or platform, but is otherwise valid. for example, attempting to choose awaffle_configwhose API is OpenGL ES1 on a system that doesn't OpenGL ES1 will produce this error. it's not your fault, it's the platform's fault. π«ΆWAFFLE_ERROR_BUILT_WITHOUT_SUPPORT = 0x13β Waffle was built without support for the requested action. for example, if Waffle was built without support for GBM, then callingwaffle_init()with attributeWAFFLE_PLATFORM=WAFFLE_PLATFORM_GBMwill produce this error. the build said no. π
π ISSUES π
please report bugs or and feature requests to https://gitlab.freedesktop.org/mesa/waffle/issues. come through, we're listening. π₯
πΈ SEE ALSO πΈ
π AUTHOR π
Chad Versace <chad.versace@linux.intel.com>
- Former maintainer
π COPYRIGHT π
Copyright Β© 2013 Intel
This manual page is licensed under the Creative Commons Attribution-ShareAlike 3.0 United States License (CC BY-SA 3.0). To view a copy of this license, visit http://creativecommons.org.license/by-sa/3.0/us.
and that's the whole page, bestie!! π no cap, you now officially understand thread-local error state better than like 90% of people who call themselves developers. this was waffle π§, dated 07/06/2026, and it lives in section WAFFLE_INIT(3) forever and always. go forth and check your error codes before you check anything else. slay β¨π¦π
π¦ where this page comes from
- ubuntu stonking: libwaffle-doc 1.8.3-1 Β· BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms