summaryrefslogtreecommitdiff
path: root/src/dged/process.h
blob: cefec8c7300df0a3ae0b2350eb543f7b75c28c2e (plain)
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
#ifndef _PROCESS_H
#define _PROCESS_H

#include <stdbool.h>
#include <stdint.h>

#ifdef _WIN32
typedef HANDLE fd_t;
#else
typedef int fd_t;
#endif

struct platform_process;
struct process {
  uint64_t id;
  fd_t stdin;
  fd_t stdout;
  fd_t stderr;
  struct platform_process *impl;
};

struct process_create_result {
  bool ok;
  const char *error_message;
};

struct process_create_result process_create(char *const command[],
                                            struct process *result);

void process_destroy(struct process *p);

bool process_running(const struct process *p);
bool process_kill(const struct process *p);

#endif