Rizin
unix-like reverse engineering framework and cli tools
main.c
Go to the documentation of this file.
1 #include <stdio.h>
2 #include <inttypes.h>
3 
4 #include <uv.h>
5 
9 
10 void on_exit(uv_process_t *req, int64_t exit_status, int term_signal) {
11  fprintf(stderr, "Process exited with status %" PRId64 ", signal %d\n", exit_status, term_signal);
13 }
14 
15 int main() {
17 
18  char* args[3];
19  args[0] = "mkdir";
20  args[1] = "test-dir";
21  args[2] = NULL;
22 
24  options.file = "mkdir";
25  options.args = args;
26 
27  int r;
28  if ((r = uv_spawn(loop, &child_req, &options))) {
29  fprintf(stderr, "%s\n", uv_strerror(r));
30  return 1;
31  } else {
32  fprintf(stderr, "Launched process with ID %d\n", child_req.pid);
33  }
34 
35  return uv_run(loop, UV_RUN_DEFAULT);
36 }
#define NULL
Definition: cris-opc.c:27
#define r
Definition: crypto_rc6.c:12
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec req
Definition: sflib.h:128
#define PRId64
Definition: macros.h:17
int main(int argc, const char **argv)
Definition: main.c:340
long int64_t
Definition: sftypes.h:32
Definition: uv.h:1780
const char * file
Definition: uv.h:953
char ** args
Definition: uv.h:960
uv_exit_cb exit_cb
Definition: uv.h:952
int pid
Definition: uv.h:1051
uv_process_options_t options
Definition: main.c:9
uv_loop_t * loop
Definition: main.c:7
uv_process_t child_req
Definition: main.c:8
void on_exit(uv_process_t *req, int64_t exit_status, int term_signal)
Definition: main.c:11
struct Arg * args
Definition: mipsasm.c:18
static enum exit_status_type exit_status
Exit status to use. This can be changed with set_exit_status().
Definition: main.c:17
@ UV_RUN_DEFAULT
Definition: uv.h:255
UV_EXTERN int uv_spawn(uv_loop_t *loop, uv_process_t *handle, const uv_process_options_t *options)
Definition: process.c:408
UV_EXTERN int uv_run(uv_loop_t *, uv_run_mode mode)
Definition: core.c:365
UV_EXTERN void uv_close(uv_handle_t *handle, uv_close_cb close_cb)
Definition: core.c:108
UV_EXTERN const char * uv_strerror(int err)
Definition: uv-common.c:212
UV_EXTERN uv_loop_t * uv_default_loop(void)
Definition: uv-common.c:763