aboutsummaryrefslogtreecommitdiff
path: root/src/ui_ipc.h
blob: 5ecfaa4e45a764ca659865ebd33408e3cd7426fa (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef UI_IPC_H
#define UI_IPC_H 1

#include "status.h"
#include "config.h"

#define IPC_MQSIZ 128


enum UI_IPC_SEM {
  SEM_RD = 0,  /* UI Init done? */
  SEM_UI,      /* TUI active? */
  SEM_IN,      /* Textfield has input avail */
  SEM_BS,      /* Master process busy */
  SEM_NUM
};

enum UI_IPC_MSQ {
  MQ_PW = 0,
  MQ_IF,
  MSQ_NUM
};


int
ui_ipc_init(int is_master);

void
ui_ipc_free(int is_master);

int
ui_ipc_sempost(enum UI_IPC_SEM e_sp);

int
ui_ipc_semwait(enum UI_IPC_SEM e_sp);

int
ui_ipc_semtrywait(enum UI_IPC_SEM e_sp);

int
ui_ipc_getvalue(enum UI_IPC_SEM e_sp);

#ifdef SEM_TIMEDWAIT
int
ui_ipc_semtimedwait(enum UI_IPC_MSQ e_sp, int timeout);
#endif

int
ui_ipc_msgsend(enum UI_IPC_MSQ e_mq, const char *msg_ptr);

ssize_t
ui_ipc_msgrecv(enum UI_IPC_MSQ e_mq, char *msg_ptr);

long
ui_ipc_msgcount(enum UI_IPC_MSQ e_mq);

#endif