docs: Add documentation to code (#7)

main
Sean McBride 5 years ago committed by GitHub
parent e61be257f9
commit 9185852236
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -142,8 +142,8 @@ typedef enum
#define RDWR_VEC_MAX 16
#define MOD_REQ_CORE 0 // core dedicated to check module requests..
#define SBOX_NCORES (NCORES > 1 ? NCORES - 1 : NCORES) // number of sandboxing threads
#define MOD_REQ_CORE 0 // Dedicated Listener Core
#define SBOX_NCORES (NCORES > 1 ? NCORES - 1 : NCORES) // If multicore, use all but the dedicated listener core
#define SBOX_MAX_REQS (1 << 19) // random!
#define SBOX_RESP_STRSZ 32

@ -221,6 +221,9 @@ http_request_parse_sb(struct sandbox *s, size_t l)
return 0;
}
/**
* Configure Callback Functions for HTTP Events
*/
void
http_init(void)
{

@ -12,13 +12,15 @@
#include <sys/time.h>
#include <sys/resource.h>
// TODO: I think this define is unused
#define MOD_LINE_MAX 1024
i32 logfd = -1;
i32 logfd = -1; // Log File Descriptor
u32 ncores = 0; // Number of cores
u32 sbox_ncores = 0; // Number of Sandboxing Cores
u32 sbox_core_st = 0; // First Sandbox Core
u32 ncores = 0, sbox_ncores = 0, sbox_core_st = 0;
pthread_t rtthd[SBOX_NCORES];
pthread_t rtthd[SBOX_NCORES]; // An array of runtime threads
static unsigned long long
get_time()

@ -281,6 +281,15 @@ sandbox_exit(void)
#endif
}
/**
* @brief Execution Loop of the listener core, handles HTTP requests, allocates sandbox request objects, and pushes the sandbox object to the global dequeue
* @param d Unknown
* @return NULL
*
* Used Globals:
* epfd - the epoll file descriptor
*
*/
void *
runtime_accept_thdfn(void *d)
{
@ -319,6 +328,9 @@ runtime_accept_thdfn(void *d)
return NULL;
}
/**
* Initialize runtime global state, mask signals, and init http server
*/
void
runtime_init(void)
{
@ -326,6 +338,8 @@ runtime_init(void)
assert(epfd >= 0);
glb_dq = (struct deque_sandbox *)malloc(sizeof(struct deque_sandbox));
assert(glb_dq);
// Note: Below is a Macro
deque_init_sandbox(glb_dq, SBOX_MAX_REQS);
softint_mask(SIGUSR1);
@ -334,6 +348,9 @@ runtime_init(void)
http_init();
}
/**
* Initializes the listener thread, pinned to core 0, and starts to listen for requests
*/
void
runtime_thd_init(void)
{

@ -23,6 +23,10 @@ util_remove_spaces(char *str)
}
/**
* Parses a JSON file and allocates one or more new modules
* @param filename The path of the JSON file
*/
int
util_parse_modules_file_json(char *filename)
{

Loading…
Cancel
Save