Arm MAP Metric Plugin Interface
Metric Plugin Interface for MAP
allinea_safe_syscalls.h File Reference

Async signal safe I/O functions for use in metric plugins. More...

#include <stdarg.h>
#include <stdlib.h>
#include <stddef.h>
Include dependency graph for allinea_safe_syscalls.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

Standard Utility Functions

Replacements for common libc utility functions.

Since metric library functions need to be async signal safe most standard libc functions cannot be used. In addition, even basic syscalls (such as read and write) cannot be used without risking corruption of some other metrics the enclosing profiler may be tracking (for example, bytes read or bytes written). The following functions can be safely called inside signal handlers and will accommodate I/O being done by the metric plugin without corrupting I/O metrics being tracked by the enclosing profiler.

struct timespec allinea_get_current_time (void)
 Gets the current time using the same clock as the enclosing profiler (async-signal-safe). More...
 
int allinea_safe_close (int fd)
 Closes the file descriptor fd previously opened by allinea_safe_open (async-signal-safe). More...
 
void allinea_safe_fprintf (int fd, const char *format,...)
 An async-signal-safe version of fprintf. More...
 
int allinea_safe_open (const char *file, int oflags,...)
 Opens the given file for reading or writing (async-signal-safe). More...
 
void allinea_safe_printf (const char *format,...)
 An async-signal-safe replacement for printf. More...
 
ssize_t allinea_safe_read (int fd, void *buf, size_t count)
 Reads up to count bytes from buf to fd (async-signal-safe) More...
 
ssize_t allinea_safe_read_all (int fd, void *buf, size_t count)
 Reads the entire contents of fd into buf (async-signal-safe). More...
 
ssize_t allinea_safe_read_all_with_alloc (int fd, void **buf, size_t *count)
 Reads the entire contents of fd into buf (async-signal-safe). More...
 
ssize_t allinea_safe_read_line (int fd, void *buf, size_t count)
 Reads a line from fd into buf (async-signal-safe). More...
 
void allinea_safe_vfprintf (int fd, const char *format, va_list ap)
 An async-signal-safe version of vfprintf. More...
 
ssize_t allinea_safe_write (int fd, const void *buf, size_t count)
 Writes up to count bytes from buf to fd (async-signal-safe). More...
 

Detailed Description

Async signal safe I/O functions for use in metric plugins.