mirror of
https://github.com/pikvm/ustreamer.git
synced 2026-03-02 13:51:41 +00:00
Initial commit
This commit is contained in:
36
src/tools.h
Normal file
36
src/tools.h
Normal file
@@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
||||
#define SEP_INFO(_x_ch) \
|
||||
{ for (int _i = 0; _i < 80; ++_i) putchar(_x_ch); putchar('\n'); }
|
||||
|
||||
#define LOG_INFO(_x_msg, ...) \
|
||||
printf("-- INFO -- " _x_msg "\n", ##__VA_ARGS__)
|
||||
|
||||
#ifdef DEBUG
|
||||
# define LOG_DEBUG(_x_msg, ...) \
|
||||
printf(" DEBUG -- " _x_msg "\n", ##__VA_ARGS__)
|
||||
# define SEP_DEBUG(_x_ch) \
|
||||
SEP_INFO(_x_ch)
|
||||
#else
|
||||
# define LOG_DEBUG(...)
|
||||
# define SEP_DEBUG(_x_ch)
|
||||
#endif
|
||||
|
||||
#define LOG_ERROR(_x_msg, ...) \
|
||||
printf("** ERROR -- " _x_msg "\n", ##__VA_ARGS__)
|
||||
|
||||
#define LOG_PERROR(_x_msg, ...) \
|
||||
printf("** ERROR -- " _x_msg ": %s\n", ##__VA_ARGS__, strerror(errno))
|
||||
|
||||
|
||||
#define MEMSET_ZERO(_x_obj) memset(&(_x_obj), 0, sizeof(_x_obj))
|
||||
|
||||
#define XIOCTL_RETRIES 4
|
||||
|
||||
|
||||
int xioctl(const int fd, const int request, void *arg);
|
||||
Reference in New Issue
Block a user