utility functions
More...
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/time.h>
#include <time.h>
#include <math.h>
#include <stdio.h>
Go to the source code of this file.
Defines |
#define | UTIL_C |
#define | BASE64_CHARS "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" |
#define | TZ "%z" |
#define | DO_AS_CALLER(action) |
Functions |
int | strcmp (const char *s1, const char *s2) |
int | touch (char *path, char *str) |
char * | base64 (const unsigned char *str, int n) |
| convert the input to base64
|
int * | get_command_line_size () |
static char * | get_command_line (int pid) |
| get the command line corresponding to a process
|
void | set_msec (char *timestamp, suseconds_t msec) |
void | set_timestamp (char *timestamp) |
| get a string representing the time in ISO8601 format
|
int | get_limit (int argc, char **argv) |
| look for the limit "--" in argv argument number arguments
|
char * | array_to_container_string (char **array, size_t n, char open_char, char close_char, char sep1, char sep2) |
| get a concatenated string from an array of string
|
int * | falloc_fails () |
int * | fcalloc_fails () |
void * | fmalloc (size_t size) |
void * | fcalloc (size_t nmemb, size_t size) |
void * | frealloc (void *ptr, size_t size) |
char * | integer_concat (char *prefix, int i, char *suffix) |
char * | concat (char *a, char *b) |
int * | fk_sleep_return_value () |
int * | fk_sleep_enabled () |
int | fk_sleep (int n) |
static void | mkdir_p (const char *dir) |
Detailed Description
utility functions
Definition in file util.c.
Define Documentation
#define DO_AS_CALLER |
( |
|
action | ) |
|
Value:struct fuse_context* __context = fuse_get_context(); \
gid_t __gid = getegid(); \
uid_t __uid = geteuid(); \
setegid(__context->gid); \
seteuid(__context->uid); \
action \
seteuid(__uid); \
setegid(__gid);
Definition at line 327 of file util.c.
Function Documentation
char* base64 |
( |
const unsigned char * |
str, |
|
|
int |
n |
|
) |
| |
convert the input to base64
- Parameters:
-
input | the input string |
size | of the input string |
- Returns:
- a newly allocated string with the base64 data which should be free'd by the user
Definition at line 38 of file util.c.
char* concat |
( |
char * |
a, |
|
|
char * |
b |
|
) |
| |
- Returns:
- null if a or b is null, a + "/" + b otherwise
Definition at line 279 of file util.c.
get the command line corresponding to a process
- Parameters:
-
- Returns:
- a base64 encoded string with the process command line, or an empty string if it could not be extrcated
Definition at line 80 of file util.c.
look for the limit "--" in argv argument number arguments
- Returns:
- the index of the limit, argc if it is not found
Definition at line 218 of file util.c.
get a string representing the time in ISO8601 format
- Parameters:
-
timestamp | string to set to the given time |
- Returns:
- void
Definition at line 136 of file util.c.