-
Notifications
You must be signed in to change notification settings - Fork 0
/
wrapper.h
53 lines (44 loc) · 1.16 KB
/
wrapper.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef LIBGETARGV_H_
#define LIBGETARGV_H_
/*-
* Copyright: see LICENSE file
*/
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include <sys/types.h>
#ifndef __cplusplus
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
#include <stdbool.h>
#else
typedef enum { false, true } bool;
#endif
#endif
struct GetArgvOptions {
uint skip;
pid_t pid;
bool nuls;
};
struct ArgvArgcResult {
char* buffer;
char** argv;
uint argc;
};
struct ArgvResult {
char* buffer;
char* start_pointer;
char* end_pointer;
};
int32_t get_arg_exact(pid_t pid);
bool print_argv_of_pid_to(const char* start_pointer, const char* end_pointer, FILE* outstream);
bool get_argv_of_pid_no_malloc(const struct GetArgvOptions* options, struct ArgvResult* retVal, size_t argsize);
bool print_argv_of_pid(const char* start_pointer, const char* end_pointer);
bool get_argv_of_pid(const struct GetArgvOptions* options, struct ArgvResult* result);
bool get_argv_and_argc_of_pid(pid_t pid, struct ArgvArgcResult* result);
void free_ArgvArgcResult(struct ArgvArgcResult* result);
void free_ArgvResult(struct ArgvResult* result);
#ifdef __cplusplus
}
#endif
#endif