|
Serene Runtime 1.0.0-dev
C runtime for the Serene programming language
|
#include "serene/utils.h"#include <stdio.h>#include <stdlib.h>#include <string.h>#include <time.h>#include "config.h"#include "serene/rt/context.h"#include "serene/rt/mm/interface.h"Go to the source code of this file.
Functions | |
| void | srn_panic (const char *msg, const char *file, size_t line, const char *fn) |
| TODO(lxsameer): unwind the stack. | |
| uint64_t | srn_now_ns (void) |
| The current time on the monotonic clock, in nanoseconds. | |
| char * | srn_copy_bytes (const srn_context_t *ctx, const char *src, size_t len, size_t alignment) |
| char * | srn_dup_str (srn_mm_t *mm, const char *s) |
| Copy a null terminated C string into a fresh allocation made through mm. | |
| char * srn_copy_bytes | ( | const srn_context_t * | ctx, |
| const char * | src, | ||
| size_t | len, | ||
| size_t | alignment ) |
Definition at line 56 of file utils.c.
| char * srn_dup_str | ( | srn_mm_t * | mm, |
| const char * | s ) |
Copy a null terminated C string into a fresh allocation made through mm.
Returns nullptr on allocation failure.
Definition at line 70 of file utils.c.
| uint64_t srn_now_ns | ( | void | ) |
The current time on the monotonic clock, in nanoseconds.
Panics if the clock read fails – CLOCK_MONOTONIC with a valid buffer cannot fail on supported targets, so a failure means something is deeply wrong.
Definition at line 46 of file utils.c.
| void srn_panic | ( | const char * | msg, |
| const char * | file, | ||
| size_t | line, | ||
| const char * | fn ) |
TODO(lxsameer): unwind the stack.
Definition at line 31 of file utils.c.