MCPcopy Create free account
hub / github.com/aws/clock-bound / print_clockbound_err

Function print_clockbound_err

examples/client/c/src/clockbound_loop_forever.c:55–75  ·  view source on GitHub ↗

* Helper function to print out errors returned by libclockbound. */

Source from the content-addressed store, hash-verified

53 * Helper function to print out errors returned by libclockbound.
54 */
55void print_clockbound_err(const clockbound_err *err) {
56 if (err == NULL) {
57 return;
58 }
59 switch (err->kind) {
60 case CLOCKBOUND_ERR_SYSCALL:
61 fprintf(stderr, "%s(%d): %s: %s\n", format_err_kind(err->kind),
62 err->errno, strerror(err->errno), err->detail);
63 break;
64 case CLOCKBOUND_ERR_NONE:
65 case CLOCKBOUND_ERR_SEGMENT_MALFORMED:
66 case CLOCKBOUND_ERR_SEGMENT_NOT_INITIALIZED:
67 case CLOCKBOUND_ERR_SEGMENT_VERSION_NOT_SUPPORTED:
68 case CLOCKBOUND_ERR_CAUSALITY_BREACH:
69 fprintf(stderr, "%s(%d): %s\n", format_err_kind(err->kind),
70 err->errno, err->detail);
71 break;
72 default:
73 fprintf(stderr, "Unexpected error\n");
74 }
75}
76
77int main(int argc, char *argv[]) {
78 char const* clockbound_shm_path = CLOCKBOUND_SHM_DEFAULT_PATH;

Callers 1

mainFunction · 0.70

Calls 1

format_err_kindFunction · 0.70

Tested by

no test coverage detected