Permalink
Browse files

Rename the internal "vev" API to a proper "VEV" prefix.

  • Loading branch information...
bsdphk committed Nov 13, 2017
1 parent 94ed598 commit 793cbad0c6f4d247c06bd592cc71768a6f6f06cf
View
@@ -7,9 +7,6 @@
-printf(2, VSB_printf)
-esym(755, vct_*)
-esym(759, vev_*)
-esym(765, vev_*)
-esym(714, vev_*)
-esym(759, vpf_*)
-esym(765, vpf_*)
-esym(714, vpf_*)
View
@@ -54,7 +54,7 @@ struct parspec;
struct vcc;
struct vclprog;
extern struct vev_base *mgt_evb;
extern struct vev_root *mgt_evb;
extern unsigned d_flag;
extern int exit_status;
@@ -221,7 +221,7 @@ static int __match_proto__(vev_cb_f)
child_listener(const struct vev *e, int what)
{
if ((what & ~EV_RD) || VLU_Fd(child_std_vlu, child_output)) {
if ((what & ~VEV__RD) || VLU_Fd(child_std_vlu, child_output)) {
ev_listen = NULL;
if (e != NULL)
mgt_reap_child();
@@ -365,22 +365,22 @@ mgt_launch_child(struct cli *cli)
AN(child_std_vlu);
AZ(ev_listen);
e = vev_new();
e = VEV_Alloc();
XXXAN(e);
e->fd = child_output;
e->fd_flags = EV_RD;
e->fd_flags = VEV__RD;
e->name = "Child listener";
e->callback = child_listener;
AZ(vev_add(mgt_evb, e));
AZ(VEV_Start(mgt_evb, e));
ev_listen = e;
AZ(ev_poker);
if (mgt_param.ping_interval > 0) {
e = vev_new();
e = VEV_Alloc();
XXXAN(e);
e->timeout = mgt_param.ping_interval;
e->callback = child_poker;
e->name = "child poker";
AZ(vev_add(mgt_evb, e));
AZ(VEV_Start(mgt_evb, e));
ev_poker = e;
}
@@ -439,14 +439,14 @@ mgt_reap_child(void)
/* Stop the poker */
if (ev_poker != NULL) {
vev_del(mgt_evb, ev_poker);
VEV_Stop(mgt_evb, ev_poker);
free(ev_poker);
}
ev_poker = NULL;
/* Stop the listener */
if (ev_listen != NULL) {
vev_del(mgt_evb, ev_listen);
VEV_Stop(mgt_evb, ev_listen);
free(ev_listen);
ev_listen = NULL;
}
@@ -522,7 +522,7 @@ mgt_reap_child(void)
child_state = CH_DIED;
/* Pick up any stuff lingering on stdout/stderr */
(void)child_listener(NULL, EV_RD);
(void)child_listener(NULL, VEV__RD);
closefd(&child_output);
VLU_Destroy(&child_std_vlu);
View
@@ -422,14 +422,14 @@ mgt_cli_setup(int fdi, int fdo, int auth, const char *ident,
AZ(VSB_finish(cli->sb));
(void)VCLI_WriteResult(fdo, cli->result, VSB_data(cli->sb));
ev = vev_new();
ev = VEV_Alloc();
AN(ev);
ev->name = cli->ident;
ev->fd = fdi;
ev->fd_flags = EV_RD;
ev->fd_flags = VEV__RD;
ev->callback = mgt_cli_callback2;
ev->priv = cli;
AZ(vev_add(mgt_evb, ev));
AZ(VEV_Start(mgt_evb, ev));
}
/*--------------------------------------------------------------------*/
@@ -554,13 +554,13 @@ mct_callback(void *priv, const struct suckaddr *sa)
VTCP_myname(sock, abuf, sizeof abuf, pbuf, sizeof pbuf);
VSB_printf(vsb, "%s %s\n", abuf, pbuf);
tn = telnet_new(sock);
tn->ev = vev_new();
tn->ev = VEV_Alloc();
AN(tn->ev);
tn->ev->fd = sock;
tn->ev->fd_flags = POLLIN;
tn->ev->callback = telnet_accept;
tn->ev->priv = tn;
AZ(vev_add(mgt_evb, tn->ev));
AZ(VEV_Start(mgt_evb, tn->ev));
}
return (0);
}
@@ -663,14 +663,14 @@ Marg_poker(const struct vev *e, int what)
MCH_TrackHighFd(s);
M_conn = vev_new();
M_conn = VEV_Alloc();
AN(M_conn);
M_conn->callback = Marg_connect;
M_conn->name = "-M connector";
M_conn->fd_flags = EV_WR;
M_conn->fd_flags = VEV__WR;
M_conn->fd = s;
M_fd = s;
AZ(vev_add(mgt_evb, M_conn));
AZ(VEV_Start(mgt_evb, M_conn));
return (0);
}
@@ -702,12 +702,12 @@ mgt_cli_master(const char *M_arg)
if (VTAILQ_EMPTY(&m_addr_list))
ARGV_ERR("Could not resolve -M argument to address\n");
AZ(M_poker);
M_poker = vev_new();
M_poker = VEV_Alloc();
AN(M_poker);
M_poker->timeout = M_poll;
M_poker->callback = Marg_poker;
M_poker->name = "-M poker";
AZ(vev_add(mgt_evb, M_poker));
AZ(VEV_Start(mgt_evb, M_poker));
}
static int
@@ -61,7 +61,7 @@
struct heritage heritage;
unsigned d_flag = 0;
struct vev_base *mgt_evb;
struct vev_root *mgt_evb;
int exit_status = 0;
struct vsb *vident;
struct VSC_mgt *VSC_C_mgt;
@@ -563,7 +563,7 @@ main(int argc, char * const *argv)
/* Various initializations */
VTAILQ_INIT(&heritage.socks);
mgt_evb = vev_new_base();
mgt_evb = VEV_New();
AN(mgt_evb);
/* Initialize transport protocols */
@@ -845,10 +845,10 @@ main(int argc, char * const *argv)
fprintf(stderr, "BEGIN of -I file processing\n");
mgt_cli_setup(I_fd, 2, 1, "-I file", mgt_I_close, stderr);
while (I_fd >= 0) {
o = vev_schedule_one(mgt_evb);
o = VEV_Once(mgt_evb);
if (o != 1)
MGT_Complain(C_ERR,
"vev_schedule_one() = %d", o);
"VEV_Once() = %d", o);
}
}
@@ -871,30 +871,30 @@ main(int argc, char * const *argv)
if (F_flag)
VFIL_null_fd(STDIN_FILENO);
e = vev_new();
e = VEV_Alloc();
AN(e);
e->callback = mgt_uptime;
e->timeout = 1.0;
e->name = "mgt_uptime";
AZ(vev_add(mgt_evb, e));
AZ(VEV_Start(mgt_evb, e));
e = vev_new();
e = VEV_Alloc();
AN(e);
e->sig = SIGTERM;
e->callback = mgt_sigint;
e->name = "mgt_sigterm";
AZ(vev_add(mgt_evb, e));
AZ(VEV_Start(mgt_evb, e));
e = vev_new();
e = VEV_Alloc();
AN(e);
e->sig = SIGINT;
e->callback = mgt_sigint;
e->name = "mgt_sigint";
AZ(vev_add(mgt_evb, e));
AZ(VEV_Start(mgt_evb, e));
o = vev_schedule(mgt_evb);
o = VEV_Loop(mgt_evb);
if (o != 0)
MGT_Complain(C_ERR, "vev_schedule() = %d", o);
MGT_Complain(C_ERR, "VEV_Loop() = %d", o);
MGT_Complain(C_INFO, "manager dies");
(void)VPF_Remove(pfh1);
@@ -917,13 +917,13 @@ void
mgt_vcl_init(void)
{
e_poker = vev_new();
e_poker = VEV_Alloc();
AN(e_poker);
e_poker->timeout = 3; // random, prime
e_poker->callback = mgt_vcl_poker;
e_poker->name = "vcl poker";
AZ(vev_add(mgt_evb, e_poker));
AZ(VEV_Start(mgt_evb, e_poker));
AZ(atexit(mgt_vcl_atexit));
View
@@ -81,7 +81,7 @@ unsigned vtc_maxdur = 60;
static unsigned vtc_bufsiz = 1024 * 1024;
static VTAILQ_HEAD(, vtc_tst) tst_head = VTAILQ_HEAD_INITIALIZER(tst_head);
static struct vev_base *vb;
static struct vev_root *vb;
static int njob = 0;
static int npar = 1; /* Number of parallel tests */
static int vtc_continue; /* Continue on error */
@@ -167,7 +167,7 @@ tst_cb(const struct vev *ve, int what)
jp->killed = 1;
AZ(kill(-jp->child, SIGKILL)); /* XXX: Timeout */
} else {
assert(what & (EV_RD | EV_HUP));
assert(what & (VEV__RD | VEV__HUP));
}
*buf = '\0';
@@ -241,7 +241,7 @@ tst_cb(const struct vev *ve, int what)
ecode ? "skipped" : "passed", t);
}
if (jp->evt != NULL)
vev_del(vb, jp->evt);
VEV_Stop(vb, jp->evt);
FREE_OBJ(jp);
return (1);
@@ -309,21 +309,21 @@ start_test(void)
}
closefd(&p[1]);
jp->ev = vev_new();
jp->ev = VEV_Alloc();
AN(jp->ev);
jp->ev->fd_flags = EV_RD | EV_HUP | EV_ERR;
jp->ev->fd_flags = VEV__RD | VEV__HUP | VEV__ERR;
jp->ev->fd = p[0];
jp->ev->priv = jp;
jp->ev->callback = tst_cb;
AZ(vev_add(vb, jp->ev));
AZ(VEV_Start(vb, jp->ev));
jp->evt = vev_new();
jp->evt = VEV_Alloc();
AN(jp->evt);
jp->evt->fd = -1;
jp->evt->timeout = vtc_maxdur;
jp->evt->priv = jp;
jp->evt->callback = tst_cb;
AZ(vev_add(vb, jp->evt));
AZ(VEV_Start(vb, jp->evt));
}
/**********************************************************************
@@ -666,7 +666,7 @@ main(int argc, char * const *argv)
if (iflg)
i_mode();
vb = vev_new_base();
vb = VEV_New();
i = 0;
while (!VTAILQ_EMPTY(&tst_head) || i) {
@@ -679,7 +679,7 @@ main(int argc, char * const *argv)
i = 1;
continue;
}
i = vev_schedule_one(vb);
i = VEV_Once(vb);
}
if (vtc_continue)
fprintf(stderr,
View
@@ -29,7 +29,7 @@
*/
struct vev;
struct vev_base;
struct vev_root;
typedef int vev_cb_f(const struct vev *, int what);
@@ -42,11 +42,11 @@ struct vev {
int fd;
unsigned fd_flags;
unsigned fd_events;
#define EV_RD POLLIN
#define EV_WR POLLOUT
#define EV_ERR POLLERR
#define EV_HUP POLLHUP
#define EV_SIG -1
#define VEV__RD POLLIN
#define VEV__WR POLLOUT
#define VEV__ERR POLLERR
#define VEV__HUP POLLHUP
#define VEV__SIG -1
int sig;
unsigned sig_flags;
double timeout;
@@ -57,16 +57,16 @@ struct vev {
double __when;
unsigned __binheap_idx;
unsigned __privflags;
struct vev_base *__vevb;
struct vev_root *__vevb;
};
struct vev_base *vev_new_base(void);
void vev_destroy_base(struct vev_base *evb);
struct vev_root *VEV_New(void);
void VEV_Destroy(struct vev_root *evb);
struct vev *vev_new(void);
struct vev *VEV_Alloc(void);
int vev_add(struct vev_base *evb, struct vev *e);
void vev_del(struct vev_base *evb, struct vev *e);
int VEV_Start(struct vev_root *evb, struct vev *e);
void VEV_Stop(struct vev_root *evb, struct vev *e);
int vev_schedule_one(struct vev_base *evb);
int vev_schedule(struct vev_base *evb);
int VEV_Once(struct vev_root *evb);
int VEV_Loop(struct vev_root *evb);
Oops, something went wrong.

0 comments on commit 793cbad

Please sign in to comment.