-
Notifications
You must be signed in to change notification settings - Fork 3
/
shell.h
65 lines (51 loc) · 1.35 KB
/
shell.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
54
55
56
57
58
59
60
61
62
63
64
65
/*
SPDX-License-Identifier: GPL-2.0-or-later
UMKa - User-Mode KolibriOS developer tools
umka_shell - the shell
Copyright (C) 2020-2023 Ivan Baravy <[email protected]>
*/
#ifndef SHELL_H_INCLUDED
#define SHELL_H_INCLUDED
#include <stdatomic.h>
#include <stdio.h>
#include <pthread.h>
#include "umka.h"
#include "umkaio.h"
#include "optparse/optparse.h"
enum shell_var_type {
SHELL_VAR_SINT,
SHELL_VAR_UINT,
SHELL_VAR_POINTER,
};
#define SHELL_LOG_NONREPRODUCIBLE 0
#define SHELL_LOG_REPRODUCIBLE 1
#define SHELL_VAR_NAME_LEN 16
struct shell_var {
struct shell_var *next;
enum shell_var_type type;
char name[SHELL_VAR_NAME_LEN];
union {ssize_t sint; size_t uint; uint64_t uint64; void *ptr;} value;
};
struct shell_ctx {
const struct umka_ctx *umka;
const struct umka_io *io;
int reproducible;
const char *hist_file;
struct shell_var *var;
FILE *fin;
FILE *fout;
const atomic_int *running;
pthread_cond_t cmd_done;
pthread_mutex_t cmd_mutex;
struct optparse opts;
};
struct shell_ctx *
shell_init(const int reproducible, const char *hist_file,
const struct umka_ctx *umka, const struct umka_io *io, FILE *fin);
void
shell_close(struct shell_ctx *shell);
void *
run_test(struct shell_ctx *ctx);
void
umka_run_cmd_sync(struct shell_ctx *ctx);
#endif // SHELL_H_INCLUDED