explain_adjtimex(3)

πŸ“¦
version 1.4.D001 Β· 2 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu resolute

πŸ’– explain_adjtimex β€” Library Functions Manual πŸ’–

okay bestie, so this is explain_adjtimex from the libexplain library, and it's literally here to explain adjtimex(2) errors to you like a friend who actually gets it πŸ’…


✨ NAME ✨

explain_adjtimex β€” it explains adjtimex(2) errors. that's it, that's the whole job πŸŽ€


🌸 SYNOPSIS 🌸

#include <libexplain/adjtimex.h>
const char *explain_adjtimex(struct timex *data);
const char *explain_errno_adjtimex(int errnum, struct timex *data);
void explain_message_adjtimex(char *message, int message_size, struct
timex *data);
void explain_message_errno_adjtimex(char *message, int message_size, int
errnum, struct timex *data);

πŸ¦‹ DESCRIPTION πŸ¦‹

so these functions are the ones you call when adjtimex(2) said no and you need to know why. they give you explanations for errors returned by the adjtimex(2) system call. very demure, very mindful, very "here's what actually went wrong" 🫢


πŸ‘‘ explain_adjtimex

const char *explain_adjtimex(struct timex *data);

the explain_adjtimex function is used to obtain an explanation of an error returned by the adjtimex(2) system call. the least the message will contain is the value of strerror(errno), but usually it will do much better than that and tell you the underlying cause in more detail. it's giving overachiever, and we love that for it πŸ’–

the errno global variable will be used to obtain the error value to be decoded. yes, the real one, the global, no cap.

  • data β€” the original data, exactly as passed to the adjtimex(2) system call. like, exactly exactly. don't get cute with it.

Returns:

the message explaining the error. this message buffer is shared by all libexplain functions which do not supply a buffer in their argument list. it will be overwritten by the next call to any libexplain function which shares this buffer, including other threads. so like... screenshot it before someone else edits the group chat 😭

Note: this function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library. periodt. don't say I didn't warn you πŸ’€

Example: this function is intended to be used in a fashion similar to the following example:

int result = adjtimex(data);
if (result < 0)
{
    fprintf(stderr, "%s\n", explain_adjtimex(data));
    exit(EXIT_FAILURE);
}

the above code example is available pre‐packaged as the explain_adjtimex_or_die(3) function. iconic behaviour, honestly ✨


🌈 explain_errno_adjtimex

const char *explain_errno_adjtimex(int errnum, struct timex *data);

the explain_errno_adjtimex function is used to obtain an explanation of an error returned by the adjtimex(2) system call. the least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail.

  • errnum β€” the error value to be decoded, usually obtained from the errno global variable just before this function is called. this is necessary if you need to call any code between the system call to be explained and this function, because many libc functions will alter the value of errno. so grab it early, bestie, that number does not stay put πŸ™ˆ
  • data β€” the original data, exactly as passed to the adjtimex(2) system call.

Returns:

the message explaining the error. this message buffer is shared by all libexplain functions which do not supply a buffer in their argument list. this will be overwritten by the next call to any libexplain function which shares this buffer, including other threads.

Note: this function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library. fr fr.

Example: this function is intended to be used in a fashion similar to the following example:

int result = adjtimex(data);
if (result < 0)
{
    int err = errno;
    fprintf(stderr, "%s\n", explain_errno_adjtimex(err, data));
    exit(EXIT_FAILURE);
}

the above code example is available pre‐packaged as the explain_adjtimex_or_die(3) function. πŸŽ€


πŸ’œ explain_message_adjtimex

void explain_message_adjtimex(char *message, int message_size, struct
timex *data);

the explain_message_adjtimex function is used to obtain an explanation of an error returned by the adjtimex(2) system call. the least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail.

the errno global variable will be used to obtain the error value to be decoded.

  • message β€” the location in which to store the returned message. if a suitable message return buffer is supplied, this function is thread safe. look at you, supplying your own buffer, main character energy πŸ‘‘
  • message_size β€” the size in bytes of the location in which to store the returned message.
  • data β€” the original data, exactly as passed to the adjtimex(2) system call.

Example: this function is intended to be used in a fashion similar to the following example:

int result = adjtimex(data);
if (result < 0)
{
    char message[3000];
    explain_message_adjtimex(message, sizeof(message), data);
    fprintf(stderr, "%s\n", message);
    exit(EXIT_FAILURE);
}

the above code example is available pre‐packaged as the explain_adjtimex_or_die(3) function. 🌸


πŸ“ explain_message_errno_adjtimex

void explain_message_errno_adjtimex(char *message, int message_size, int
errnum, struct timex *data);

the explain_message_errno_adjtimex function is used to obtain an explanation of an error returned by the adjtimex(2) system call. the least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail.

  • message β€” the location in which to store the returned message. if a suitable message return buffer is supplied, this function is thread safe.
  • message_size β€” the size in bytes of the location in which to store the returned message.
  • errnum β€” the error value to be decoded, usually obtained from the errno global variable just before this function is called. this is necessary if you need to call any code between the system call to be explained and this function, because many libc functions will alter the value of errno. yeah. same warning as before. it's a whole thing 🫠
  • data β€” the original data, exactly as passed to the adjtimex(2) system call.

Example: this function is intended to be used in a fashion similar to the following example:

int result = adjtimex(data);
if (result < 0)
{
    int err = errno;
    char message[3000];
    explain_message_errno_adjtimex(message, sizeof(message), err,
    data);
    fprintf(stderr, "%s\n", message);
    exit(EXIT_FAILURE);
}

the above code example is available pre‐packaged as the explain_adjtimex_or_die(3) function. slay πŸ’…


πŸ”₯ SEE ALSO πŸ”₯


  • libexplain version 1.4
  • Copyright (C) 2009 Peter Miller

and that's the whole page, bestie 🧚 libexplain version 1.4, copyright (C) 2009 Peter Miller β€” mwah, go forth and explain those errors πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from