From e3a7e12639c34fd86d48a072beb48add8c498d09 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 10 Oct 2021 18:10:09 +0200 Subject: [PATCH] Rename ->{pre,post}_select methods to ->{pre,post}_monitor. The word "monitor" is neutral and continues to be correct after the switch from select(2) to poll(2). Pure rename, nothing to see here. --- aacdec_filter.c | 6 +++--- afh_recv.c | 10 +++++----- afs.c | 14 +++++++------- alsa_write.c | 8 ++++---- amp_filter.c | 6 +++--- ao_write.c | 8 ++++---- audioc.c | 8 ++++---- audiod.c | 30 +++++++++++++++--------------- buffer_tree.c | 4 ++-- check_wav.c | 10 +++++----- check_wav.h | 4 ++-- client.c | 12 ++++++------ client_common.c | 8 ++++---- compress_filter.c | 6 +++--- dccp_recv.c | 10 +++++----- dccp_send.c | 8 ++++---- fecdec_filter.c | 6 +++--- file_write.c | 8 ++++---- filter.c | 4 ++-- filter.h | 6 +++--- filter_common.c | 2 +- flacdec_filter.c | 8 ++++---- grab_client.c | 14 +++++++------- gui.c | 32 ++++++++++++++++---------------- http_recv.c | 10 +++++----- http_send.c | 8 ++++---- interactive.c | 8 ++++---- mp3dec_filter.c | 8 ++++---- oggdec_filter.c | 10 +++++----- opusdec_filter.c | 8 ++++---- oss_write.c | 8 ++++---- play.c | 28 ++++++++++++++-------------- prebuffer_filter.c | 8 ++++---- recv.c | 4 ++-- recv.h | 10 +++++----- recv_common.c | 2 +- resample_filter.c | 14 +++++++------- sched.c | 46 +++++++++++++++++++++++----------------------- sched.h | 12 ++++++------ send.h | 4 ++-- server.c | 16 ++++++++-------- signal.h | 2 +- spxdec_filter.c | 6 +++--- stdin.c | 8 ++++---- stdout.c | 8 ++++---- sync_filter.c | 8 ++++---- udp_recv.c | 10 +++++----- vss.c | 18 +++++++++--------- wav_filter.c | 8 ++++---- wmadec_filter.c | 6 +++--- write.c | 12 ++++++------ write.h | 4 ++-- write_common.c | 4 ++-- 53 files changed, 265 insertions(+), 265 deletions(-) diff --git a/aacdec_filter.c b/aacdec_filter.c index a2459d82..36a783c5 100644 --- a/aacdec_filter.c +++ b/aacdec_filter.c @@ -74,7 +74,7 @@ static void aacdec_close(struct filter_node *fn) fn->private_data = NULL; } -static int aacdec_post_select(__a_unused struct sched *s, void *context) +static int aacdec_post_monitor(__a_unused struct sched *s, void *context) { struct filter_node *fn = context; struct btr_node *btrn = fn->btrn; @@ -158,7 +158,7 @@ err: const struct filter lsg_filter_cmd_com_aacdec_user_data = { .open = aacdec_open, .close = aacdec_close, - .pre_select = generic_filter_pre_select, - .post_select = aacdec_post_select, + .pre_monitor = generic_filter_pre_monitor, + .post_monitor = aacdec_post_monitor, .execute = aacdec_execute }; diff --git a/afh_recv.c b/afh_recv.c index 6a0ec239..889fdce8 100644 --- a/afh_recv.c +++ b/afh_recv.c @@ -142,14 +142,14 @@ static void afh_recv_close(struct receiver_node *rn) freep(&rn->private_data); } -static void afh_recv_pre_select(struct sched *s, void *context) +static void afh_recv_pre_monitor(struct sched *s, void *context) { struct receiver_node *rn = context; struct private_afh_recv_data *pard = rn->private_data; struct afh_info *afhi = &pard->afhi; struct lls_parse_result *lpr = rn->lpr; struct timeval chunk_time; - int state = generic_recv_pre_select(s, rn); + int state = generic_recv_pre_monitor(s, rn); unsigned j_given = RECV_CMD_OPT_GIVEN(AFH, JUST_IN_TIME, lpr); if (state <= 0) @@ -163,7 +163,7 @@ static void afh_recv_pre_select(struct sched *s, void *context) sched_request_barrier_or_min_delay(&chunk_time, s); } -static int afh_recv_post_select(__a_unused struct sched *s, void *context) +static int afh_recv_post_monitor(__a_unused struct sched *s, void *context) { struct receiver_node *rn = context; struct lls_parse_result *lpr = rn->lpr; @@ -242,7 +242,7 @@ out: const struct receiver lsg_recv_cmd_com_afh_user_data = { .open = afh_recv_open, .close = afh_recv_close, - .pre_select = afh_recv_pre_select, - .post_select = afh_recv_post_select, + .pre_monitor = afh_recv_pre_monitor, + .post_monitor = afh_recv_post_monitor, .execute = afh_execute, }; diff --git a/afs.c b/afs.c index 99a53b68..febe13b3 100644 --- a/afs.c +++ b/afs.c @@ -707,7 +707,7 @@ static int open_afs_tables(void) return ret; } -static int afs_signal_post_select(struct sched *s, __a_unused void *context) +static int afs_signal_post_monitor(struct sched *s, __a_unused void *context) { int signum, ret; @@ -743,8 +743,8 @@ static void register_signal_task(struct sched *s) signal_task->task = task_register(&(struct task_info) { .name = "signal", - .pre_select = signal_pre_select, - .post_select = afs_signal_post_select, + .pre_monitor = signal_pre_monitor, + .post_monitor = afs_signal_post_monitor, .context = signal_task, }, s); @@ -762,7 +762,7 @@ struct afs_client { struct timeval connect_time; }; -static void command_pre_select(struct sched *s, void *context) +static void command_pre_monitor(struct sched *s, void *context) { struct command_task *ct = context; struct afs_client *client; @@ -917,7 +917,7 @@ err: /** Shutdown connection if query has not arrived until this many seconds. */ #define AFS_CLIENT_TIMEOUT 3 -static int command_post_select(struct sched *s, void *context) +static int command_post_monitor(struct sched *s, void *context) { struct command_task *ct = context; struct sockaddr_un unix_addr; @@ -973,8 +973,8 @@ static void register_command_task(struct sched *s) ct->task = task_register(&(struct task_info) { .name = "afs command", - .pre_select = command_pre_select, - .post_select = command_post_select, + .pre_monitor = command_pre_monitor, + .post_monitor = command_post_monitor, .context = ct, }, s); } diff --git a/alsa_write.c b/alsa_write.c index b13697ab..2bf3fd0e 100644 --- a/alsa_write.c +++ b/alsa_write.c @@ -202,7 +202,7 @@ out: return ret; } -static void alsa_write_pre_select(struct sched *s, void *context) +static void alsa_write_pre_monitor(struct sched *s, void *context) { struct pollfd pfd; struct writer_node *wn = context; @@ -254,7 +254,7 @@ free_pad: free(pad); } -static int alsa_write_post_select(__a_unused struct sched *s, void *context) +static int alsa_write_post_monitor(__a_unused struct sched *s, void *context) { struct writer_node *wn = context; struct private_alsa_write_data *pad = wn->private_data; @@ -349,7 +349,7 @@ err: struct writer lsg_write_cmd_com_alsa_user_data = { - .pre_select = alsa_write_pre_select, - .post_select = alsa_write_post_select, + .pre_monitor = alsa_write_pre_monitor, + .post_monitor = alsa_write_post_monitor, .close = alsa_close, }; diff --git a/amp_filter.c b/amp_filter.c index 61b1653e..9369e4bc 100644 --- a/amp_filter.c +++ b/amp_filter.c @@ -43,7 +43,7 @@ static void amp_open(struct filter_node *fn) pad->amp, pad->amp / 64.0 + 1.0); } -static int amp_post_select(__a_unused struct sched *s, void *context) +static int amp_post_monitor(__a_unused struct sched *s, void *context) { struct filter_node *fn = context; struct private_amp_data *pad = fn->private_data; @@ -100,6 +100,6 @@ err: const struct filter lsg_filter_cmd_com_amp_user_data = { .open = amp_open, .close = amp_close, - .pre_select = generic_filter_pre_select, - .post_select = amp_post_select, + .pre_monitor = generic_filter_pre_monitor, + .post_monitor = amp_post_monitor, }; diff --git a/ao_write.c b/ao_write.c index 037b9299..41e609b7 100644 --- a/ao_write.c +++ b/ao_write.c @@ -42,7 +42,7 @@ static void aow_close(struct writer_node *wn) ao_shutdown(); } -static void aow_pre_select(struct sched *s, void *context) +static void aow_pre_monitor(struct sched *s, void *context) { struct writer_node *wn = context; struct private_aow_data *pawd = wn->private_data; @@ -342,7 +342,7 @@ fail: return -E_AO_PTHREAD; } -static int aow_post_select(__a_unused struct sched *s, void *context) +static int aow_post_monitor(__a_unused struct sched *s, void *context) { struct writer_node *wn = context; struct private_aow_data *pawd = wn->private_data; @@ -421,7 +421,7 @@ out: struct writer lsg_write_cmd_com_ao_user_data = { .close = aow_close, - .pre_select = aow_pre_select, - .post_select = aow_post_select, + .pre_monitor = aow_pre_monitor, + .post_monitor = aow_post_monitor, }; diff --git a/audioc.c b/audioc.c index 248f6fb6..932f0d30 100644 --- a/audioc.c +++ b/audioc.c @@ -143,7 +143,7 @@ static struct i9e_completer audiod_completers[] = { {.name = NULL} }; -static void audioc_pre_select(struct sched *s, void *context) +static void audioc_pre_monitor(struct sched *s, void *context) { struct audioc_task *at = context; int ret = btr_node_status(at->btrn, 0, BTR_NT_ROOT); @@ -153,7 +153,7 @@ static void audioc_pre_select(struct sched *s, void *context) sched_monitor_readfd(at->fd, s); } -static int audioc_post_select(struct sched *s, void *context) +static int audioc_post_monitor(struct sched *s, void *context) { char *buf = NULL; struct audioc_task *at = context; @@ -211,8 +211,8 @@ static int audioc_i9e_line_handler(char *line) EMBRACE(.name = "audioc line handler")); at->task = task_register(&(struct task_info) { .name = "audioc", - .pre_select = audioc_pre_select, - .post_select = audioc_post_select, + .pre_monitor = audioc_pre_monitor, + .post_monitor = audioc_post_monitor, .context = at, }, &sched); i9e_attach_to_stdout(at->btrn); diff --git a/audiod.c b/audiod.c index 1dc70e5e..311462e6 100644 --- a/audiod.c +++ b/audiod.c @@ -584,8 +584,8 @@ static void open_filters(struct slot_info *s) sprintf(buf, "%s (slot %d)", name, (int)(s - slot)); fn->task = task_register(&(struct task_info) { .name = buf, - .pre_select = f->pre_select, - .post_select = f->post_select, + .pre_monitor = f->pre_monitor, + .post_monitor = f->post_monitor, .context = fn, }, &sched); parent = fn->btrn; @@ -648,8 +648,8 @@ static int open_receiver(int format) audio_formats[format], name, slot_num); rn->task = task_register(&(struct task_info) { .name = name, - .pre_select = r->pre_select, - .post_select = r->post_select, + .pre_monitor = r->pre_monitor, + .post_monitor = r->post_monitor, .context = rn, }, &sched); return slot_num; @@ -1055,7 +1055,7 @@ static void init_local_socket(struct command_task *ct) exit(EXIT_FAILURE); } -static int signal_post_select(struct sched *s, void *context) +static int signal_post_monitor(struct sched *s, void *context) { struct signal_task *st = context; int ret, signum; @@ -1075,13 +1075,13 @@ static int signal_post_select(struct sched *s, void *context) return 0; } -static void command_pre_select(struct sched *s, void *context) +static void command_pre_monitor(struct sched *s, void *context) { struct command_task *ct = context; sched_monitor_readfd(ct->fd, s); } -static int command_post_select(struct sched *s, void *context) +static int command_post_monitor(struct sched *s, void *context) { int ret; struct command_task *ct = context; @@ -1132,8 +1132,8 @@ static void init_command_task(struct command_task *ct) ct->task = task_register(&(struct task_info) { .name = "command", - .pre_select = command_pre_select, - .post_select = command_post_select, + .pre_monitor = command_pre_monitor, + .post_monitor = command_post_monitor, .context = ct, }, &sched); } @@ -1254,7 +1254,7 @@ static void start_stop_decoders(void) audiod_status_dump(true); } -static void status_pre_select(struct sched *s, void *context) +static void status_pre_monitor(struct sched *s, void *context) { struct status_task *st = context; int i, ret, cafn = stat_task->current_audio_format_num; @@ -1286,7 +1286,7 @@ min_delay: } /* restart the client task if necessary */ -static int status_post_select(struct sched *s, void *context) +static int status_post_monitor(struct sched *s, void *context) { struct status_task *st = context; int ret; @@ -1377,8 +1377,8 @@ static void init_status_task(struct status_task *st) stat_task->task = task_register(&(struct task_info) { .name = "stat", - .pre_select = status_pre_select, - .post_select = status_post_select, + .pre_monitor = status_pre_monitor, + .post_monitor = status_post_monitor, .context = stat_task, }, &sched); } @@ -1505,8 +1505,8 @@ int main(int argc, char *argv[]) signal_task->task = task_register(&(struct task_info) { .name = "signal", - .pre_select = signal_pre_select, - .post_select = signal_post_select, + .pre_monitor = signal_pre_monitor, + .post_monitor = signal_post_monitor, .context = signal_task, }, &sched); diff --git a/buffer_tree.c b/buffer_tree.c index f0d2002d..49e40fb9 100644 --- a/buffer_tree.c +++ b/buffer_tree.c @@ -570,7 +570,7 @@ bool btr_no_parent(struct btr_node *btrn) * buffer. * * Since the buffer tree may change at any time, this function should be called - * during each post_select call. + * during each post_monitor call. * * \return True if \a btrn has no siblings. */ @@ -1181,7 +1181,7 @@ struct btr_node *btr_search_node(const char *name, struct btr_node *root) * \param type The supposed type of \a btrn. * * Most users of the buffer tree subsystem call this function from both - * their pre_select and the post_select methods. + * their ->pre_monitor() and ->post_monitor() methods. * * \return Negative if an error condition was detected, zero if there * is nothing to do and positive otherwise. diff --git a/check_wav.c b/check_wav.c index 074ad8fe..100975dc 100644 --- a/check_wav.c +++ b/check_wav.c @@ -47,7 +47,7 @@ struct check_wav_context { * If no data is available and the buffer tree node is not in error state, the * function does nothing. */ -void check_wav_pre_select(struct sched *s, struct check_wav_context *cwc) +void check_wav_pre_monitor(struct sched *s, struct check_wav_context *cwc) { int ret = btr_node_status(cwc->btrn, cwc->min_iqs, BTR_NT_INTERNAL); if (ret != 0) @@ -121,7 +121,7 @@ out: * * \return Standard. */ -int check_wav_post_select(struct check_wav_context *cwc) +int check_wav_post_monitor(struct check_wav_context *cwc) { struct btr_node *btrn = cwc->btrn; unsigned char *a; @@ -198,8 +198,8 @@ out: * children of this node can figure out channel count, sample rate, etc. * * \return The (opaque) handle of the newly created check_wav instance. It is - * supposed to be passed to \ref check_wav_pre_select() and \ref - * check_wav_post_select(). + * supposed to be passed to \ref check_wav_pre_monitor() and \ref + * check_wav_post_monitor(). * * \sa \ref btr_new_node. */ @@ -225,7 +225,7 @@ struct check_wav_context *check_wav_init(struct btr_node *parent, * * \param cwc Determines the instance to shut down. * - * This function may only be called after check_wav_post_select() has returned + * This function may only be called after check_wav_post_monitor() has returned * negative. */ void check_wav_shutdown(struct check_wav_context *cwc) diff --git a/check_wav.h b/check_wav.h index 79b11962..e6188c52 100644 --- a/check_wav.h +++ b/check_wav.h @@ -42,6 +42,6 @@ struct wav_params { struct check_wav_context *check_wav_init(struct btr_node *parent, struct btr_node *child, struct wav_params *params, struct btr_node **cw_btrn); -void check_wav_pre_select(struct sched *s, struct check_wav_context *cwc); -int check_wav_post_select(struct check_wav_context *cwc); +void check_wav_pre_monitor(struct sched *s, struct check_wav_context *cwc); +int check_wav_post_monitor(struct check_wav_context *cwc); void check_wav_shutdown(struct check_wav_context *cwc); diff --git a/client.c b/client.c index 24f9c61c..827ff215 100644 --- a/client.c +++ b/client.c @@ -42,7 +42,7 @@ struct exec_task { size_t result_size; }; -static void exec_pre_select(struct sched *s, void *context) +static void exec_pre_monitor(struct sched *s, void *context) { struct exec_task *et = context; int ret = btr_node_status(et->btrn, 0, BTR_NT_LEAF); @@ -51,7 +51,7 @@ static void exec_pre_select(struct sched *s, void *context) sched_min_delay(s); } -static int exec_post_select(__a_unused struct sched *s, void *context) +static int exec_post_monitor(__a_unused struct sched *s, void *context) { struct exec_task *et = context; struct btr_node *btrn = et->btrn; @@ -138,8 +138,8 @@ static int execute_client_command(const char *cmd, char **result) EMBRACE(.name = "exec_collect")); exec_task.task = task_register(&(struct task_info) { .name = "client exec", - .pre_select = exec_pre_select, - .post_select = exec_post_select, + .pre_monitor = exec_pre_monitor, + .post_monitor = exec_post_monitor, .context = &exec_task, }, &command_sched); ret = client_connect(ct, &command_sched, NULL, exec_task.btrn); @@ -578,7 +578,7 @@ struct supervisor_task { struct task *task; }; -static int supervisor_post_select(struct sched *s, void *context) +static int supervisor_post_monitor(struct sched *s, void *context) { struct supervisor_task *svt = context; int ret = task_status(ct->task); @@ -648,7 +648,7 @@ int main(int argc, char *argv[]) EMBRACE(.name = "stdout", .parent = ct->btrn[0])); supervisor_task.task = task_register(&(struct task_info) { .name = "supervisor", - .post_select = supervisor_post_select, + .post_monitor = supervisor_post_monitor, .context = &supervisor_task, }, &sched); diff --git a/client_common.c b/client_common.c index fdd04e5a..3beeed1f 100644 --- a/client_common.c +++ b/client_common.c @@ -57,7 +57,7 @@ void client_close(struct client_task *ct) * The context pointer is assumed to refer to a client task structure that was * initialized earlier by client_open(). */ -static void client_pre_select(struct sched *s, void *context) +static void client_pre_monitor(struct sched *s, void *context) { int ret; struct client_task *ct = context; @@ -271,7 +271,7 @@ static bool has_feature(const char *feature, struct client_task *ct) * The context pointer refers to a client task structure that was initialized * earlier by client_open(). */ -static int client_post_select(struct sched *s, void *context) +static int client_post_monitor(struct sched *s, void *context) { struct client_task *ct = context; int ret = 0; @@ -500,8 +500,8 @@ int client_connect(struct client_task *ct, struct sched *s, ct->task = task_register(&(struct task_info) { .name = "client", - .pre_select = client_pre_select, - .post_select = client_post_select, + .pre_monitor = client_pre_monitor, + .post_monitor = client_post_monitor, .context = ct, }, s); return 1; diff --git a/compress_filter.c b/compress_filter.c index ff4ce6fb..9f9d8515 100644 --- a/compress_filter.c +++ b/compress_filter.c @@ -37,7 +37,7 @@ static void compress_close(struct filter_node *fn) free(fn->private_data); } -static int compress_post_select(__a_unused struct sched *s, void *context) +static int compress_post_monitor(__a_unused struct sched *s, void *context) { struct filter_node *fn = context; struct private_compress_data *pcd = fn->private_data; @@ -162,6 +162,6 @@ const struct filter lsg_filter_cmd_com_compress_user_data = { .setup = compress_setup, .open = compress_open, .close = compress_close, - .pre_select = generic_filter_pre_select, - .post_select = compress_post_select, + .pre_monitor = generic_filter_pre_monitor, + .post_monitor = compress_post_monitor, }; diff --git a/dccp_recv.c b/dccp_recv.c index 9a17269d..faacd39f 100644 --- a/dccp_recv.c +++ b/dccp_recv.c @@ -109,16 +109,16 @@ err: return ret; } -static void dccp_recv_pre_select(struct sched *s, void *context) +static void dccp_recv_pre_monitor(struct sched *s, void *context) { struct receiver_node *rn = context; - if (generic_recv_pre_select(s, rn) <= 0) + if (generic_recv_pre_monitor(s, rn) <= 0) return; sched_monitor_readfd(rn->fd, s); } -static int dccp_recv_post_select(__a_unused struct sched *s, void *context) +static int dccp_recv_post_monitor(__a_unused struct sched *s, void *context) { struct receiver_node *rn = context; struct btr_node *btrn = rn->btrn; @@ -154,6 +154,6 @@ out: const struct receiver lsg_recv_cmd_com_dccp_user_data = { .open = dccp_recv_open, .close = dccp_recv_close, - .pre_select = dccp_recv_pre_select, - .post_select = dccp_recv_post_select, + .pre_monitor = dccp_recv_pre_monitor, + .post_monitor = dccp_recv_post_monitor, }; diff --git a/dccp_send.c b/dccp_send.c index 5c274237..9e937271 100644 --- a/dccp_send.c +++ b/dccp_send.c @@ -36,7 +36,7 @@ struct dccp_fec_client { struct fec_client *fc; }; -static void dccp_pre_select(struct sched *s) +static void dccp_pre_monitor(struct sched *s) { unsigned n; @@ -118,7 +118,7 @@ static void dccp_send_fec(struct sender_client *sc, char *buf, size_t len) dccp_shutdown_client(sc); } -static void dccp_post_select(__a_unused struct sched *s) +static void dccp_post_monitor(__a_unused struct sched *s) { struct sender_client *sc; struct dccp_fec_client *dfc; @@ -248,8 +248,8 @@ const struct sender dccp_sender = { .name = "dccp", .init = dccp_send_init, .shutdown = dccp_shutdown, - .pre_select = dccp_pre_select, - .post_select = dccp_post_select, + .pre_monitor = dccp_pre_monitor, + .post_monitor = dccp_post_monitor, .shutdown_clients = dccp_shutdown_clients, .client_cmds = { [SENDER_on] = dccp_com_on, diff --git a/fecdec_filter.c b/fecdec_filter.c index 13d4f7b2..d629603c 100644 --- a/fecdec_filter.c +++ b/fecdec_filter.c @@ -431,7 +431,7 @@ static void fecdec_close(struct filter_node *fn) fn->private_data = NULL; } -static int fecdec_post_select(__a_unused struct sched *s, void *context) +static int fecdec_post_monitor(__a_unused struct sched *s, void *context) { struct filter_node *fn = context; struct btr_node *btrn = fn->btrn; @@ -478,7 +478,7 @@ static void fecdec_open(struct filter_node *fn) const struct filter lsg_filter_cmd_com_fecdec_user_data = { .open = fecdec_open, - .pre_select = generic_filter_pre_select, - .post_select = fecdec_post_select, + .pre_monitor = generic_filter_pre_monitor, + .post_monitor = fecdec_post_monitor, .close = fecdec_close, }; diff --git a/file_write.c b/file_write.c index 86c4e8ea..64153178 100644 --- a/file_write.c +++ b/file_write.c @@ -69,7 +69,7 @@ static int prepare_output_file(struct writer_node *wn) return 1; } -static void file_write_pre_select(struct sched *s, void *context) +static void file_write_pre_monitor(struct sched *s, void *context) { struct writer_node *wn = context; struct private_file_write_data *pfwd = wn->private_data; @@ -92,7 +92,7 @@ static void file_write_close(struct writer_node *wn) free(pfwd); } -static int file_write_post_select(__a_unused struct sched *s, void *context) +static int file_write_post_monitor(__a_unused struct sched *s, void *context) { struct writer_node *wn = context; struct private_file_write_data *pfwd = wn->private_data; @@ -128,7 +128,7 @@ out: /** the init function of the file writer */ struct writer lsg_write_cmd_com_file_user_data = { - .pre_select = file_write_pre_select, - .post_select = file_write_post_select, + .pre_monitor = file_write_pre_monitor, + .post_monitor = file_write_post_monitor, .close = file_write_close, }; diff --git a/filter.c b/filter.c index 95438779..85d3da7e 100644 --- a/filter.c +++ b/filter.c @@ -137,8 +137,8 @@ int main(int argc, char *argv[]) EMBRACE(.name = name, .parent = parent, .handler = f->execute, .context = fn)); ti.name = name; - ti.pre_select = f->pre_select; - ti.post_select = f->post_select; + ti.pre_monitor = f->pre_monitor; + ti.post_monitor = f->post_monitor; ti.context = fn; if (f->open) f->open(fn); diff --git a/filter.h b/filter.h index 96f3dbae..77057e6a 100644 --- a/filter.h +++ b/filter.h @@ -84,9 +84,9 @@ struct filter { */ void (*teardown)(const struct lls_parse_result *lpr, void *conf); /** Force a zero timeout if data is available in the buffer tree. */ - void (*pre_select)(struct sched *s, void *context); + void (*pre_monitor)(struct sched *s, void *context); /** Convert (filter) input data into output data. */ - int (*post_select)(struct sched *s, void *context); + int (*post_monitor)(struct sched *s, void *context); /** * Answer a buffer tree query. * @@ -112,7 +112,7 @@ int filter_setup(const char *fa, void **conf, struct lls_parse_result **lprp); #define FILTER_CMD_OPT_STRING_VAL(_cmd, _opt, _lpr) \ (lls_string_val(0, FILTER_CMD_OPT_RESULT(_cmd, _opt, _lpr))) -void generic_filter_pre_select(struct sched *s, void *context); +void generic_filter_pre_monitor(struct sched *s, void *context); int decoder_execute(const char *cmd, unsigned sample_rate, unsigned channels, char **result); diff --git a/filter_common.c b/filter_common.c index 4702df6c..f48e4570 100644 --- a/filter_common.c +++ b/filter_common.c @@ -178,7 +178,7 @@ void print_filter_list(void) * in error state) a minimal I/O timeout is requested from the scheduler. * Otherwise the function does nothing. */ -void generic_filter_pre_select(struct sched *s, void *context) +void generic_filter_pre_monitor(struct sched *s, void *context) { struct filter_node *fn = context; diff --git a/flacdec_filter.c b/flacdec_filter.c index 6a3a8eff..2c9f8607 100644 --- a/flacdec_filter.c +++ b/flacdec_filter.c @@ -205,7 +205,7 @@ static bool output_queue_full(struct btr_node *btrn) return btr_get_output_queue_size(btrn) > FLACDEC_MAX_OUTPUT_SIZE; } -static void flacdec_pre_select(struct sched *s, void *context) +static void flacdec_pre_monitor(struct sched *s, void *context) { struct filter_node *fn = context; struct private_flacdec_data *pfd = fn->private_data; @@ -221,7 +221,7 @@ static void flacdec_pre_select(struct sched *s, void *context) return sched_min_delay(s); } -static int flacdec_post_select(__a_unused struct sched *s, void *context) +static int flacdec_post_monitor(__a_unused struct sched *s, void *context) { struct filter_node *fn = context; struct private_flacdec_data *pfd = fn->private_data; @@ -294,7 +294,7 @@ static void flacdec_open(struct filter_node *fn) const struct filter lsg_filter_cmd_com_flacdec_user_data = { .open = flacdec_open, .close = flacdec_close, - .pre_select = flacdec_pre_select, - .post_select = flacdec_post_select, + .pre_monitor = flacdec_pre_monitor, + .post_monitor = flacdec_post_monitor, .execute = flacdec_execute, }; diff --git a/grab_client.c b/grab_client.c index 04d90169..393e2ce3 100644 --- a/grab_client.c +++ b/grab_client.c @@ -89,7 +89,7 @@ err: return -E_GC_WRITE; } -static void gc_pre_select(struct sched *s, void *context) +static void gc_pre_monitor(struct sched *s, void *context) { struct grab_client *gc = context; int ret = btr_node_status(gc->btrn, 0, BTR_NT_LEAF); @@ -102,10 +102,10 @@ static void gc_pre_select(struct sched *s, void *context) } /* - * We need this forward declaration as post_select() needs + * We need this forward declaration as gc_post_monitor() needs * activate_grab_client and vice versa. */ -static int gc_post_select(struct sched *s, void *context); +static int gc_post_monitor(struct sched *s, void *context); /** * Move a grab client to the active list and start it. @@ -129,8 +129,8 @@ static void gc_activate(struct grab_client *gc, struct sched *s) gc->task = task_register(&(struct task_info) { .name = name, - .pre_select = gc_pre_select, - .post_select = gc_post_select, + .pre_monitor = gc_pre_monitor, + .post_monitor = gc_post_monitor, .context = gc, }, s); } @@ -171,7 +171,7 @@ static int gc_close(struct grab_client *gc, int err) /* * We must not free the gc structure here as it contains ->task * which is still used because this function is called from - * post_select(). + * post_monitor(). */ close(gc->fd); gc->fd = -1; @@ -182,7 +182,7 @@ static int gc_close(struct grab_client *gc, int err) return 0; } -static int gc_post_select(__a_unused struct sched *s, void *context) +static int gc_post_monitor(__a_unused struct sched *s, void *context) { struct grab_client *gc = context; struct btr_node *btrn = gc->btrn; diff --git a/gui.c b/gui.c index fc7bfaf4..72908f23 100644 --- a/gui.c +++ b/gui.c @@ -609,7 +609,7 @@ static void clear_all_items(void) } } -static void status_pre_select(struct sched *s, void *context) +static void status_pre_monitor(struct sched *s, void *context) { struct status_task *st = context; @@ -621,7 +621,7 @@ static void status_pre_select(struct sched *s, void *context) sched_request_barrier_or_min_delay(&st->next_exec, s); } -static int status_post_select(__a_unused struct sched *s, void *context) +static int status_post_monitor(__a_unused struct sched *s, void *context) { struct status_task *st = context; size_t sz; @@ -892,7 +892,7 @@ static void reread_conf(void) } /* React to various signal-related events. */ -static int signal_post_select(struct sched *s, __a_unused void *context) +static int signal_post_monitor(struct sched *s, __a_unused void *context) { int ret = para_next_signal(); @@ -931,7 +931,7 @@ static enum exec_status exec_status(void) return EXEC_IDLE; } -static void exec_pre_select(struct sched *s, void *context) +static void exec_pre_monitor(struct sched *s, void *context) { struct exec_task *et = context; if (exec_fds[0] >= 0) @@ -942,7 +942,7 @@ static void exec_pre_select(struct sched *s, void *context) sched_min_delay(s); } -static int exec_post_select(__a_unused struct sched *s, void *context) +static int exec_post_monitor(__a_unused struct sched *s, void *context) { struct exec_task *ct = context; int i, ret; @@ -992,7 +992,7 @@ static int exec_post_select(__a_unused struct sched *s, void *context) return 0; } -static void input_pre_select(struct sched *s, __a_unused void *context) +static void input_pre_monitor(struct sched *s, __a_unused void *context) { if (exec_status() != EXEC_XCMD) sched_monitor_readfd(STDIN_FILENO, s); @@ -1089,7 +1089,7 @@ static void handle_command(int c) keyname); } -static int input_post_select(__a_unused struct sched *s, +static int input_post_monitor(__a_unused struct sched *s, __a_unused void *context) { int ret; @@ -1115,7 +1115,7 @@ static int input_post_select(__a_unused struct sched *s, ret = wgetch(top.win); if (ret == ERR) return 0; - if (ret == KEY_RESIZE) /* already handled in signal_post_select() */ + if (ret == KEY_RESIZE) /* already handled in signal_post_monitor() */ return 0; if (exs == EXEC_IDLE) handle_command(ret); @@ -1395,22 +1395,22 @@ static int setup_tasks_and_schedule(void) exec_task.task = task_register(&(struct task_info) { .name = "exec", - .pre_select = exec_pre_select, - .post_select = exec_post_select, + .pre_monitor = exec_pre_monitor, + .post_monitor = exec_post_monitor, .context = &exec_task, }, &sched); status_task.task = task_register(&(struct task_info) { .name = "status", - .pre_select = status_pre_select, - .post_select = status_post_select, + .pre_monitor = status_pre_monitor, + .post_monitor = status_post_monitor, .context = &status_task, }, &sched); input_task.task = task_register(&(struct task_info) { .name = "input", - .pre_select = input_pre_select, - .post_select = input_post_select, + .pre_monitor = input_pre_monitor, + .post_monitor = input_post_monitor, .context = &input_task, }, &sched); @@ -1422,8 +1422,8 @@ static int setup_tasks_and_schedule(void) para_install_sighandler(SIGWINCH); signal_task->task = task_register(&(struct task_info) { .name = "signal", - .pre_select = signal_pre_select, - .post_select = signal_post_select, + .pre_monitor = signal_pre_monitor, + .post_monitor = signal_post_monitor, .context = signal_task, }, &sched); ret = schedule(&sched); diff --git a/http_recv.c b/http_recv.c index 94e24d1b..59e9696b 100644 --- a/http_recv.c +++ b/http_recv.c @@ -56,12 +56,12 @@ static char *make_request_msg(void) return ret; } -static void http_recv_pre_select(struct sched *s, void *context) +static void http_recv_pre_monitor(struct sched *s, void *context) { struct receiver_node *rn = context; struct private_http_recv_data *phd = rn->private_data; - if (generic_recv_pre_select(s, rn) <= 0) + if (generic_recv_pre_monitor(s, rn) <= 0) return; if (phd->status == HTTP_CONNECTED) sched_monitor_writefd(rn->fd, s); @@ -74,7 +74,7 @@ static void http_recv_pre_select(struct sched *s, void *context) * area with data read from the socket. In any case, update the state of the * connection if necessary. */ -static int http_recv_post_select(struct sched *s, void *context) +static int http_recv_post_monitor(struct sched *s, void *context) { struct receiver_node *rn = context; struct private_http_recv_data *phd = rn->private_data; @@ -170,6 +170,6 @@ static int http_recv_open(struct receiver_node *rn) const struct receiver lsg_recv_cmd_com_http_user_data = { .open = http_recv_open, .close = http_recv_close, - .pre_select = http_recv_pre_select, - .post_select = http_recv_post_select, + .pre_monitor = http_recv_pre_monitor, + .post_monitor = http_recv_post_monitor, }; diff --git a/http_send.c b/http_send.c index 59fe2efa..0a90e884 100644 --- a/http_send.c +++ b/http_send.c @@ -158,7 +158,7 @@ static void http_send(long unsigned current_chunk, } } -static void http_post_select(__a_unused struct sched *s) +static void http_post_monitor(__a_unused struct sched *s) { struct sender_client *sc, *tmp; struct private_http_sender_data *phsd; @@ -196,7 +196,7 @@ static void http_post_select(__a_unused struct sched *s) phsd->status = HTTP_CONNECTED; } -static void http_pre_select(struct sched *s) +static void http_pre_monitor(struct sched *s) { struct sender_client *sc, *tmp; unsigned n; @@ -274,8 +274,8 @@ const struct sender http_sender = { .name = "http", .init = http_send_init, .shutdown = http_shutdown, - .pre_select = http_pre_select, - .post_select = http_post_select, + .pre_monitor = http_pre_monitor, + .post_monitor = http_post_monitor, .send = http_send, .shutdown_clients = http_shutdown_clients, .client_cmds = { diff --git a/interactive.c b/interactive.c index 729a0dd5..28937db4 100644 --- a/interactive.c +++ b/interactive.c @@ -282,7 +282,7 @@ free_line: free(line); } -static int i9e_post_select(__a_unused struct sched *s, __a_unused void *context) +static int i9e_post_monitor(__a_unused struct sched *s, __a_unused void *context) { int ret; struct i9e_client_info *ici = i9ep->ici; @@ -362,7 +362,7 @@ out: return ret; } -static void i9e_pre_select(struct sched *s, __a_unused void *context) +static void i9e_pre_monitor(struct sched *s, __a_unused void *context) { int ret; @@ -465,8 +465,8 @@ int i9e_open(struct i9e_client_info *ici, struct sched *s) return ret; i9ep->task = task_register(&(struct task_info) { .name = "i9e", - .pre_select = i9e_pre_select, - .post_select = i9e_post_select, + .pre_monitor = i9e_pre_monitor, + .post_monitor = i9e_post_monitor, .context = i9ep, }, s); diff --git a/mp3dec_filter.c b/mp3dec_filter.c index ccb1553b..6a196f3a 100644 --- a/mp3dec_filter.c +++ b/mp3dec_filter.c @@ -73,7 +73,7 @@ static void mp3dec_close(struct filter_node *fn) #define MP3DEC_MAX_FRAME 8192 -static int mp3dec_post_select(__a_unused struct sched *s, void *context) +static int mp3dec_post_monitor(__a_unused struct sched *s, void *context) { struct filter_node *fn = context; int i, ret; @@ -93,7 +93,7 @@ next_buffer: btr_merge(btrn, fn->min_iqs); len = btr_next_buffer(btrn, &inbuffer); /* - * Decode at most 8K in one go to give the post_select() functions of + * Decode at most 8K in one go to give the post_monitor() functions of * other buffer tree nodes a chance to run. This is necessary to avoid * buffer underruns on slow machines. */ @@ -187,7 +187,7 @@ static int mp3dec_execute(struct btr_node *btrn, const char *cmd, char **result) const struct filter lsg_filter_cmd_com_mp3dec_user_data = { .open = mp3dec_open, .close = mp3dec_close, - .pre_select = generic_filter_pre_select, - .post_select = mp3dec_post_select, + .pre_monitor = generic_filter_pre_monitor, + .post_monitor = mp3dec_post_monitor, .execute = mp3dec_execute, }; diff --git a/oggdec_filter.c b/oggdec_filter.c index 708a27e5..a6fa056a 100644 --- a/oggdec_filter.c +++ b/oggdec_filter.c @@ -178,13 +178,13 @@ out: /** * Allocate chunks of this size and produce at most one chunk of output per - * ->post_select() invocation. If the buffer could only be filled partially + * ->post_monitor() invocation. If the buffer could only be filled partially * due to insufficient input being available, it is shrunk to the real output * size and the resized buffer is fed into the output queue. */ #define OGGDEC_OUTPUT_CHUNK_SIZE (32 * 1024) -static void ogg_pre_select(struct sched *s, void *context) +static void ogg_pre_monitor(struct sched *s, void *context) { struct filter_node *fn = context; struct private_oggdec_data *pod = fn->private_data; @@ -201,7 +201,7 @@ static void ogg_pre_select(struct sched *s, void *context) sched_min_delay(s); } -static int ogg_post_select(__a_unused struct sched *s, void *context) +static int ogg_post_monitor(__a_unused struct sched *s, void *context) { struct filter_node *fn = context; struct private_oggdec_data *pod = fn->private_data; @@ -262,7 +262,7 @@ out: const struct filter lsg_filter_cmd_com_oggdec_user_data = { .open = ogg_open, .close = ogg_close, - .pre_select = ogg_pre_select, - .post_select = ogg_post_select, + .pre_monitor = ogg_pre_monitor, + .post_monitor = ogg_post_monitor, .execute = oggdec_execute }; diff --git a/opusdec_filter.c b/opusdec_filter.c index 10ed394d..31f9640b 100644 --- a/opusdec_filter.c +++ b/opusdec_filter.c @@ -207,7 +207,7 @@ static int decode_packet(struct opusdec_context *ctx, ogg_packet *op, #define OPUSDEC_MAX_OUTPUT_SIZE (1024 * 1024) -static int opusdec_post_select(__a_unused struct sched *s, void *context) +static int opusdec_post_monitor(__a_unused struct sched *s, void *context) { struct filter_node *fn = context; struct opusdec_context *ctx = fn->private_data; @@ -269,7 +269,7 @@ out: return ret; } -static void opusdec_pre_select(struct sched *s, void *context) +static void opusdec_pre_monitor(struct sched *s, void *context) { struct filter_node *fn = context; struct opusdec_context *ctx = fn->private_data; @@ -286,7 +286,7 @@ static void opusdec_pre_select(struct sched *s, void *context) const struct filter lsg_filter_cmd_com_opusdec_user_data = { .open = opusdec_open, .close = opusdec_close, - .pre_select = opusdec_pre_select, - .post_select = opusdec_post_select, + .pre_monitor = opusdec_pre_monitor, + .post_monitor = opusdec_post_monitor, .execute = opusdec_execute, }; diff --git a/oss_write.c b/oss_write.c index 794f4242..1a837e57 100644 --- a/oss_write.c +++ b/oss_write.c @@ -61,7 +61,7 @@ static int get_oss_format(enum sample_format sf) } } -static void oss_pre_select(struct sched *s, void *context) +static void oss_pre_monitor(struct sched *s, void *context) { struct writer_node *wn = context; struct private_oss_write_data *powd = wn->private_data; @@ -178,7 +178,7 @@ err_free: return ret; } -static int oss_post_select(__a_unused struct sched *s, void *context) +static int oss_post_monitor(__a_unused struct sched *s, void *context) { struct writer_node *wn = context; struct private_oss_write_data *powd = wn->private_data; @@ -245,7 +245,7 @@ out: } const struct writer lsg_write_cmd_com_oss_user_data = { - .pre_select = oss_pre_select, - .post_select = oss_post_select, + .pre_monitor = oss_pre_monitor, + .post_monitor = oss_post_monitor, .close = oss_close, }; diff --git a/play.c b/play.c index feb0f997..48da675c 100644 --- a/play.c +++ b/play.c @@ -50,7 +50,7 @@ static struct lls_parse_result *play_lpr; * Describes a request to change the state of para_play. * * There is only one variable of this type: \a rq of the global play task - * structure. Command handlers only set this variable and the post_select() + * structure. Command handlers only set this variable and the post_monitor() * function of the play task investigates its value during each iteration of * the scheduler run and performs the actual work. */ @@ -405,16 +405,16 @@ static int load_file(void) pt->rn.task = task_register( &(struct task_info) { .name = lls_command_name(AFH_RECV_CMD), - .pre_select = AFH_RECV->pre_select, - .post_select = AFH_RECV->post_select, + .pre_monitor = AFH_RECV->pre_monitor, + .post_monitor = AFH_RECV->post_monitor, .context = &pt->rn }, &sched); sprintf(buf, "%s decoder", af); pt->fn.task = task_register( &(struct task_info) { .name = buf, - .pre_select = decoder->pre_select, - .post_select = decoder->post_select, + .pre_monitor = decoder->pre_monitor, + .post_monitor = decoder->post_monitor, .context = &pt->fn }, &sched); register_writer_node(&pt->wn, pt->fn.btrn, &sched); @@ -1109,16 +1109,16 @@ static void session_update_time_string(char *str, unsigned len) /* * If we are about to die we must call i9e_close() to reset the terminal. * However, i9e_close() must be called in *this* context, i.e. from - * play_task.post_select() rather than from i9e_post_select(), because + * play_task.post_monitor() rather than from i9e_post_monitor(), because * otherwise i9e would access freed memory upon return. So the play task must * stay alive until the i9e task terminates. * * We achieve this by sending a fake SIGTERM signal via i9e_signal_dispatch() - * and reschedule. In the next iteration, i9e->post_select returns an error and + * and reschedule. In the next iteration, i9e->post_monitor returns an error and * terminates. Subsequent calls to i9e_get_error() then return negative and we * are allowed to call i9e_close() and terminate as well. */ -static int session_post_select(__a_unused struct sched *s) +static int session_post_monitor(__a_unused struct sched *s) { int ret; @@ -1141,7 +1141,7 @@ static int session_post_select(__a_unused struct sched *s) #else /* HAVE_READLINE */ -static int session_post_select(struct sched *s) +static int session_post_monitor(struct sched *s) { char c; @@ -1164,7 +1164,7 @@ static void session_update_time_string(char *str, __a_unused unsigned len) } #endif /* HAVE_READLINE */ -static void play_pre_select(struct sched *s, __a_unused void *context) +static void play_pre_monitor(struct sched *s, __a_unused void *context) { char state; @@ -1202,7 +1202,7 @@ static unsigned get_time_string(char **result) ); } -static int play_post_select(struct sched *s, __a_unused void *context) +static int play_post_monitor(struct sched *s, __a_unused void *context) { int ret; @@ -1211,7 +1211,7 @@ static int play_post_select(struct sched *s, __a_unused void *context) pt->rq = CRT_TERM_RQ; return 0; } - ret = session_post_select(s); + ret = session_post_monitor(s); if (ret < 0) goto out; if (!pt->wn.btrn && !pt->fn.btrn) { @@ -1265,8 +1265,8 @@ int main(int argc, char *argv[]) pt->playing = true; pt->task = task_register(&(struct task_info){ .name = "play", - .pre_select = play_pre_select, - .post_select = play_post_select, + .pre_monitor = play_pre_monitor, + .post_monitor = play_post_monitor, .context = pt, }, &sched); ret = schedule(&sched); diff --git a/prebuffer_filter.c b/prebuffer_filter.c index 9a801900..031aa47e 100644 --- a/prebuffer_filter.c +++ b/prebuffer_filter.c @@ -22,7 +22,7 @@ struct private_prebuffer_data { struct timeval barrier; }; -static void prebuffer_pre_select(struct sched *s, void *context) +static void prebuffer_pre_monitor(struct sched *s, void *context) { struct filter_node *fn = context; struct btr_node *btrn = fn->btrn; @@ -50,7 +50,7 @@ static void prebuffer_close(struct filter_node *fn) free(fn->private_data); } -static int prebuffer_post_select(__a_unused struct sched *s, void *context) +static int prebuffer_post_monitor(__a_unused struct sched *s, void *context) { struct filter_node *fn = context; struct btr_node *btrn = fn->btrn; @@ -87,6 +87,6 @@ static void prebuffer_open(struct filter_node *fn) const struct filter lsg_filter_cmd_com_prebuffer_user_data = { .open = prebuffer_open, .close = prebuffer_close, - .pre_select = prebuffer_pre_select, - .post_select = prebuffer_post_select, + .pre_monitor = prebuffer_pre_monitor, + .post_monitor = prebuffer_post_monitor, }; diff --git a/recv.c b/recv.c index a81eebb8..68417187 100644 --- a/recv.c +++ b/recv.c @@ -97,8 +97,8 @@ int main(int argc, char *argv[]) stdout_task_register(&sot, &s); ti.name = lls_command_name(cmd); - ti.pre_select = r->pre_select; - ti.post_select = r->post_select; + ti.pre_monitor = r->pre_monitor; + ti.post_monitor = r->post_monitor; ti.context = &rn; rn.task = task_register(&ti, &s); diff --git a/recv.h b/recv.h index 2976cad6..391395b2 100644 --- a/recv.h +++ b/recv.h @@ -21,11 +21,11 @@ struct receiver_node { /** * The file descriptor to receive the stream. * - * The pre_select function of the receiver adds this file descriptor to + * The pre_monitor function of the receiver adds this file descriptor to * the set of file descriptors which are watched for readability or * writability, depending on the state of the connection (if any). * - * If \a fd is readable, the post_select function of the receiver reads + * If \a fd is readable, the post_monitor function of the receiver reads * data from this fd into the buffer pool area of \a btrp. * * \sa \ref receiver. @@ -66,9 +66,9 @@ struct receiver { */ void (*close)(struct receiver_node *rn); /** Ask the scheduler to monitor receive fds. */ - void (*pre_select)(struct sched *s, void *context); + void (*pre_monitor)(struct sched *s, void *context); /** Receive data and make it available to consumers. */ - int (*post_select)(struct sched *s, void *context); + int (*post_monitor)(struct sched *s, void *context); /** * Answer a buffer tree query. * @@ -96,4 +96,4 @@ struct receiver { int check_receiver_arg(const char *ra, struct lls_parse_result **lprp); void print_receiver_helps(bool detailed); -int generic_recv_pre_select(struct sched *s, struct receiver_node *rn); +int generic_recv_pre_monitor(struct sched *s, struct receiver_node *rn); diff --git a/recv_common.c b/recv_common.c index 169a4967..ad34991c 100644 --- a/recv_common.c +++ b/recv_common.c @@ -110,7 +110,7 @@ void print_receiver_helps(bool detailed) * \return The status of of the receiver node's buffer tree node. That is, the * return value of the underlying call to \ref btr_node_status(). */ -int generic_recv_pre_select(struct sched *s, struct receiver_node *rn) +int generic_recv_pre_monitor(struct sched *s, struct receiver_node *rn) { int ret = btr_node_status(rn->btrn, 0, BTR_NT_ROOT); diff --git a/resample_filter.c b/resample_filter.c index bbdda51c..01b4ac48 100644 --- a/resample_filter.c +++ b/resample_filter.c @@ -62,7 +62,7 @@ static void resample_open(struct filter_node *fn) btr_log_tree(btr_parent(btr_parent(btrn)), LL_INFO); } -static void resample_pre_select(struct sched *s, void *context) +static void resample_pre_monitor(struct sched *s, void *context) { struct filter_node *fn = context; struct resample_context *ctx = fn->private_data; @@ -70,7 +70,7 @@ static void resample_pre_select(struct sched *s, void *context) if (ret != 0) return sched_min_delay(s); - check_wav_pre_select(s, ctx->cwc); + check_wav_pre_monitor(s, ctx->cwc); } static int get_btr_val(const char *what, struct btr_node *btrn) @@ -187,7 +187,7 @@ static int resample_frames(int16_t *in, size_t num_frames, bool have_more, return data.input_frames_used; } -static int resample_post_select(__a_unused struct sched *s, void *context) +static int resample_post_monitor(__a_unused struct sched *s, void *context) { int ret; struct filter_node *fn = context; @@ -197,7 +197,7 @@ static int resample_post_select(__a_unused struct sched *s, void *context) size_t in_bytes, num_frames; bool have_more; - ret = check_wav_post_select(ctx->cwc); + ret = check_wav_post_monitor(ctx->cwc); if (ret < 0) goto out; ret = btr_node_status(btrn, fn->min_iqs, BTR_NT_INTERNAL); @@ -236,7 +236,7 @@ out: if (ret < 0) { btr_remove_node(&fn->btrn); /* This releases the check_wav btr node */ - check_wav_post_select(ctx->cwc); + check_wav_post_monitor(ctx->cwc); } return ret; } @@ -277,8 +277,8 @@ static void resample_teardown(__a_unused const struct lls_parse_result *lpr, const struct filter lsg_filter_cmd_com_resample_user_data = { .setup = resample_setup, .open = resample_open, - .pre_select = resample_pre_select, - .post_select = resample_post_select, + .pre_monitor = resample_pre_monitor, + .post_monitor = resample_post_monitor, .close = resample_close, .teardown = resample_teardown, .execute = resample_execute diff --git a/sched.c b/sched.c index 4ca040f4..261809c1 100644 --- a/sched.c +++ b/sched.c @@ -17,9 +17,9 @@ * The possible states of a task. * * In addition to the states listed here, a task may also enter zombie state. - * This happens when its ->post_select function returns negative, the ->status + * This happens when its ->post_monitor function returns negative, the ->status * field is then set to this return value. Such tasks are not scheduled any - * more (i.e. ->pre_select() and ->post_select() are no longer called), but + * more (i.e. ->pre_monitor() and ->post_monitor() are no longer called), but * they stay on the scheduler task list until \ref task_reap() or * \ref sched_shutdown() is called. */ @@ -46,7 +46,7 @@ struct task { static struct timeval now_struct; const struct timeval *now = &now_struct; -static void sched_preselect(struct sched *s) +static void sched_pre_monitor(struct sched *s) { struct task *t, *tmp; @@ -55,8 +55,8 @@ static void sched_preselect(struct sched *s) continue; if (t->notification != 0) sched_min_delay(s); - if (t->info.pre_select) - t->info.pre_select(s, t->info.context); + if (t->info.pre_monitor) + t->info.pre_monitor(s, t->info.context); } } @@ -72,29 +72,29 @@ static void unlink_and_free_task(struct task *t) } //#define SCHED_DEBUG 1 -static inline void call_post_select(struct sched *s, struct task *t) +static inline void call_post_monitor(struct sched *s, struct task *t) { int ret; #ifndef SCHED_DEBUG - ret = t->info.post_select(s, t->info.context); + ret = t->info.post_monitor(s, t->info.context); #else struct timeval t1, t2, diff; unsigned long pst; clock_get_realtime(&t1); - ret = t->info.post_select(s, t->info.context); + ret = t->info.post_monitor(s, t->info.context); clock_get_realtime(&t2); tv_diff(&t1, &t2, &diff); pst = tv2ms(&diff); if (pst > 50) - PARA_WARNING_LOG("%s: post_select time: %lums\n", + PARA_WARNING_LOG("%s: post_monitor time: %lums\n", t->name, pst); #endif t->status = ret < 0? ret : TS_RUNNING; } -static unsigned sched_post_select(struct sched *s) +static unsigned sched_post_monitor(struct sched *s) { struct task *t, *tmp; unsigned num_running_tasks = 0; @@ -103,7 +103,7 @@ static unsigned sched_post_select(struct sched *s) if (t->status == TS_DEAD) /* task has been reaped */ unlink_and_free_task(t); else if (t->status == TS_RUNNING) { - call_post_select(s, t); /* sets t->status */ + call_post_monitor(s, t); /* sets t->status */ t->notification = 0; if (t->status == TS_RUNNING) num_running_tasks++; @@ -118,9 +118,9 @@ static unsigned sched_post_select(struct sched *s) * \param s Pointer to the scheduler struct. * * This function updates the global \a now pointer, calls all registered - * pre_select hooks which may set the timeout and add any file descriptors to - * the fd sets of \a s. Next, it calls para_select() and makes the result available - * to the registered tasks by calling their post_select hook. + * pre_monitor hooks which may set the timeout and add any file descriptors to + * the fd sets of \a s. Next, it calls para_select() and makes the result + * available to the registered tasks by calling their post_monitor hook. * * \return Zero if no more tasks are left in the task list, negative if the * select function returned an error. @@ -140,7 +140,7 @@ again: s->timeout = s->default_timeout; s->max_fileno = -1; clock_get_realtime(&now_struct); - sched_preselect(s); + sched_pre_monitor(s); ret = s->select_function(s->max_fileno + 1, &s->rfds, &s->wfds, s->timeout); if (ret < 0) @@ -156,7 +156,7 @@ again: FD_ZERO(&s->wfds); } clock_get_realtime(&now_struct); - num_running_tasks = sched_post_select(s); + num_running_tasks = sched_post_monitor(s); if (num_running_tasks == 0) return 0; goto again; @@ -197,7 +197,7 @@ int task_reap(struct task **tptr) /* * With list_for_each_entry_safe() it is only safe to remove the * _current_ list item. Since we are being called from the loop in - * schedule() via some task's ->post_select() function, freeing the + * schedule() via some task's ->post_monitor() function, freeing the * given task here would result in use-after-free bugs in schedule(). * So we only set the task status to TS_DEAD which tells schedule() to * free the task in the next iteration of its loop. @@ -241,7 +241,7 @@ struct task *task_register(struct task_info *info, struct sched *s) { struct task *t = para_malloc(sizeof(*t)); - assert(info->post_select); + assert(info->post_monitor); if (!s->task_list.next) init_list_head(&s->task_list); @@ -288,14 +288,14 @@ char *get_task_list(struct sched *s) * \param err A positive error code. * * Tasks which honor notifications are supposed to call \ref - * task_get_notification() in their post_select function and act on the + * task_get_notification() in their post_monitor function and act on the * returned notification value. * - * If the scheduler detects during its pre_select loop that at least one task - * has been notified, the loop terminates, and the post_select methods of all + * If the scheduler detects during its pre_monitor loop that at least one task + * has been notified, the loop terminates, and the post_monitor methods of all * taks are immediately called again. * - * The notification for a task is reset after the call to its post_select + * The notification for a task is reset after the call to its post_monitor * method. * * \sa \ref task_get_notification(). @@ -316,7 +316,7 @@ void task_notify(struct task *t, int err) * * \return The notification value. If this is negative, the task has been * notified by another task. Tasks are supposed to check for notifications by - * calling this function from their post_select method. + * calling this function from their post_monitor method. * * \sa \ref task_notify(). */ diff --git a/sched.h b/sched.h index f89b89ff..77dc5748 100644 --- a/sched.h +++ b/sched.h @@ -7,15 +7,15 @@ * Paraslash's scheduler. * * Designed with KISS in mind. It maintains a list of task structures which is - * extended when a new task is registered. Each task may define a pre_select + * extended when a new task is registered. Each task may define a pre_monitor * function which is called from the scheduler main loop before it calls - * select(). Similarly, each task must define a post_select function which is + * select(). Similarly, each task must define a post_monitor function which is * called after the select call. * * \sa select(2), poll(2). */ struct sched { - /** Initial value (in milliseconds) before any pre_select call. */ + /** Initial value (in milliseconds) before any pre_monitor call. */ int default_timeout; /** The timeout (also in milliseconds) for the next select call. */ int timeout; @@ -49,7 +49,7 @@ struct task_info { * * \sa \ref time.c. */ - void (*pre_select)(struct sched *s, void *context); + void (*pre_monitor)(struct sched *s, void *context); /** * Perform I/O on file descriptors which are ready for I/O. * @@ -60,10 +60,10 @@ struct task_info { * If this function returns a negative value, the scheduler unregisters * the task. */ - int (*post_select)(struct sched *s, void *context); + int (*post_monitor)(struct sched *s, void *context); /** * This pointer is saved when the task is registered. It is passed to - * ->pre_select() and ->post_select(). Usually this is a pointer to the + * ->pre_monitor() and ->post_monitor(). Usually this is a pointer to the * struct owned by the caller which contains the task pointer. */ void *context; diff --git a/send.h b/send.h index 25a1103d..dec5b0db 100644 --- a/send.h +++ b/send.h @@ -77,9 +77,9 @@ struct sender { const char *buf, size_t len, const char *header_buf, size_t header_len); /** Ask the scheduler to monitor file descriptors. */ - void (*pre_select)(struct sched *s); + void (*pre_monitor)(struct sched *s); /** Perform I/O on the file descriptors which are ready. */ - void (*post_select)(struct sched *s); + void (*post_monitor)(struct sched *s); /** * Terminate all connected clients. * diff --git a/server.c b/server.c index 91fb9dff..5da384d8 100644 --- a/server.c +++ b/server.c @@ -250,7 +250,7 @@ static void handle_sighup(void) kill(afs_pid, SIGHUP); } -static int signal_post_select(struct sched *s, __a_unused void *context) +static int signal_post_monitor(struct sched *s, __a_unused void *context) { int ret, signum; @@ -313,14 +313,14 @@ static void init_signal_task(void) add_close_on_fork_list(signal_task->fd); signal_task->task = task_register(&(struct task_info) { .name = "signal", - .pre_select = signal_pre_select, - .post_select = signal_post_select, + .pre_monitor = signal_pre_monitor, + .post_monitor = signal_post_monitor, .context = signal_task, }, &sched); } -static void command_pre_select(struct sched *s, void *context) +static void command_pre_monitor(struct sched *s, void *context) { unsigned n; struct server_command_task *sct = context; @@ -383,7 +383,7 @@ static int command_task_accept(unsigned listen_idx, struct sched *s, /* * After we return, the scheduler calls server_select() with a minimal * timeout value, because the remaining tasks have a notification - * pending. Next it calls the ->post_select method of these tasks, + * pending. Next it calls the ->post_monitor method of these tasks, * which will return negative in view of the notification. This causes * schedule() to return as there are no more runnable tasks. * @@ -399,7 +399,7 @@ out: return 0; } -static int command_post_select(struct sched *s, void *context) +static int command_post_monitor(struct sched *s, void *context) { struct server_command_task *sct = context; unsigned n; @@ -459,8 +459,8 @@ static void init_server_command_task(struct server_command_task *sct, sct->task = task_register(&(struct task_info) { .name = "server command", - .pre_select = command_pre_select, - .post_select = command_post_select, + .pre_monitor = command_pre_monitor, + .post_monitor = command_post_monitor, .context = sct, }, &sched); /* diff --git a/signal.h b/signal.h index d65d18e3..d9e98e78 100644 --- a/signal.h +++ b/signal.h @@ -27,7 +27,7 @@ struct signal_task { * structure, the parameter is specified as void * here to match the signature * declared in struct \ref task_info. */ -_static_inline_ void signal_pre_select(struct sched *s, void *context) +_static_inline_ void signal_pre_monitor(struct sched *s, void *context) { struct signal_task *st = context; sched_monitor_readfd(st->fd, s); diff --git a/spxdec_filter.c b/spxdec_filter.c index 7be817dd..94a9c788 100644 --- a/spxdec_filter.c +++ b/spxdec_filter.c @@ -246,7 +246,7 @@ static int compute_skip_samples(ogg_page *og, struct private_spxdec_data *psd) return ret; } -static int speexdec_post_select(__a_unused struct sched *s, void *context) +static int speexdec_post_monitor(__a_unused struct sched *s, void *context) { struct filter_node *fn = context; struct private_spxdec_data *psd = fn->private_data; @@ -305,7 +305,7 @@ fail: const struct filter lsg_filter_cmd_com_spxdec_user_data = { .open = spxdec_open, .close = speexdec_close, - .pre_select = generic_filter_pre_select, - .post_select = speexdec_post_select, + .pre_monitor = generic_filter_pre_monitor, + .post_monitor = speexdec_post_monitor, .execute = speexdec_execute, }; diff --git a/stdin.c b/stdin.c index 607435d2..d025b949 100644 --- a/stdin.c +++ b/stdin.c @@ -17,7 +17,7 @@ * If there is space left in the buffer of the stdin task, ask the scheduler to * monitor STDIN_FILENO. */ -static void stdin_pre_select(struct sched *s, void *context) +static void stdin_pre_monitor(struct sched *s, void *context) { struct stdin_task *sit = context; int ret; @@ -36,7 +36,7 @@ static void stdin_pre_select(struct sched *s, void *context) * Feed data from stdin into the buffer tree if STDIN_FILENO is ready for * reading. */ -static int stdin_post_select(__a_unused struct sched *s, void *context) +static int stdin_post_monitor(__a_unused struct sched *s, void *context) { struct stdin_task *sit = context; ssize_t ret; @@ -90,8 +90,8 @@ void stdin_task_register(struct stdin_task *sit, struct sched *s) int ret; struct task_info ti = { .name = "stdin", - .pre_select = stdin_pre_select, - .post_select = stdin_post_select, + .pre_monitor = stdin_pre_monitor, + .post_monitor = stdin_post_monitor, .context = sit, }; diff --git a/stdout.c b/stdout.c index f31b8675..ba5f1967 100644 --- a/stdout.c +++ b/stdout.c @@ -11,7 +11,7 @@ #include "buffer_tree.h" /* Monitor STDOUT_FILENO if there is input data available. */ -static void stdout_pre_select(struct sched *s, void *context) +static void stdout_pre_monitor(struct sched *s, void *context) { struct stdout_task *sot = context; int ret; @@ -27,7 +27,7 @@ static void stdout_pre_select(struct sched *s, void *context) * If input from the buffer tree is available and STDOUT_FILENO is ready, write * as much as possible. */ -static int stdout_post_select(struct sched *s, void *context) +static int stdout_post_monitor(struct sched *s, void *context) { struct stdout_task *sot = context; struct btr_node *btrn = sot->btrn; @@ -79,8 +79,8 @@ void stdout_task_register(struct stdout_task *sot, struct sched *s) { int ret; struct task_info ti = { - .pre_select = stdout_pre_select, - .post_select = stdout_post_select, + .pre_monitor = stdout_pre_monitor, + .post_monitor = stdout_post_monitor, .context = sot, .name = "stdout", }; diff --git a/sync_filter.c b/sync_filter.c index ec5bb273..3174a4ef 100644 --- a/sync_filter.c +++ b/sync_filter.c @@ -248,7 +248,7 @@ static void sync_set_timeout(struct sync_filter_context *ctx, tv_add(now, &to, &ctx->timeout); } -static void sync_pre_select(struct sched *s, void *context) +static void sync_pre_monitor(struct sched *s, void *context) { int ret; struct filter_node *fn = context; @@ -284,7 +284,7 @@ static struct sync_buddy *sync_find_buddy(struct sockaddr *addr, return NULL; } -static int sync_post_select(__a_unused struct sched *s, void *context) +static int sync_post_monitor(__a_unused struct sched *s, void *context) { int ret; struct filter_node *fn = context; @@ -377,8 +377,8 @@ out: const struct filter lsg_filter_cmd_com_sync_user_data = { .setup = sync_setup, .open = sync_open, - .pre_select = sync_pre_select, - .post_select = sync_post_select, + .pre_monitor = sync_pre_monitor, + .post_monitor = sync_post_monitor, .close = sync_close, .teardown = sync_teardown }; diff --git a/udp_recv.c b/udp_recv.c index 94ad4512..8d1274bc 100644 --- a/udp_recv.c +++ b/udp_recv.c @@ -23,11 +23,11 @@ #include "net.h" #include "fd.h" -static void udp_recv_pre_select(struct sched *s, void *context) +static void udp_recv_pre_monitor(struct sched *s, void *context) { struct receiver_node *rn = context; - if (generic_recv_pre_select(s, rn) <= 0) + if (generic_recv_pre_monitor(s, rn) <= 0) return; sched_monitor_readfd(rn->fd, s); } @@ -50,7 +50,7 @@ static int udp_check_eof(size_t sz, struct iovec iov[2]) return -E_RECV_EOF; } -static int udp_recv_post_select(__a_unused struct sched *s, void *context) +static int udp_recv_post_monitor(__a_unused struct sched *s, void *context) { struct receiver_node *rn = context; struct btr_node *btrn = rn->btrn; @@ -189,6 +189,6 @@ err: const struct receiver lsg_recv_cmd_com_udp_user_data = { .open = udp_recv_open, .close = udp_recv_close, - .pre_select = udp_recv_pre_select, - .post_select = udp_recv_post_select, + .pre_monitor = udp_recv_pre_monitor, + .post_monitor = udp_recv_post_monitor, }; diff --git a/vss.c b/vss.c index 49fd7ae2..4f270c4a 100644 --- a/vss.c +++ b/vss.c @@ -892,7 +892,7 @@ static void set_mmd_offset(void) mmd->offset = tv2ms(&offset); } -static void vss_pre_select(struct sched *s, void *context) +static void vss_pre_monitor(struct sched *s, void *context) { int i; struct vss_task *vsst = context; @@ -904,9 +904,9 @@ static void vss_pre_select(struct sched *s, void *context) } else sched_monitor_readfd(vsst->afs_socket, s); FOR_EACH_SENDER(i) { - if (!senders[i]->pre_select) + if (!senders[i]->pre_monitor) continue; - senders[i]->pre_select(s); + senders[i]->pre_monitor(s); } vss_compute_timeout(s, vsst); } @@ -1016,7 +1016,7 @@ err: /** * Main sending function. * - * This function gets called from vss_post_select(). It checks whether the next + * This function gets called from vss_post_monitor(). It checks whether the next * chunk of data should be pushed out. It obtains a pointer to the data to be * sent out as well as its length from mmd->afd.afhi. This information is then * passed to each supported sender's send() function as well as to the send() @@ -1087,7 +1087,7 @@ static void vss_send(struct vss_task *vsst) mmd->current_chunk++; } -static int vss_post_select(struct sched *s, void *context) +static int vss_post_monitor(struct sched *s, void *context) { int ret, i; struct vss_task *vsst = context; @@ -1147,9 +1147,9 @@ static int vss_post_select(struct sched *s, void *context) vsst->afsss = AFS_SOCKET_AFD_PENDING; } FOR_EACH_SENDER(i) { - if (!senders[i]->post_select) + if (!senders[i]->post_monitor) continue; - senders[i]->post_select(s); + senders[i]->post_monitor(s); } if ((vss_playing() && !(mmd->vss_status_flags & VSS_PLAYING)) || (vss_next() && vss_playing())) @@ -1194,8 +1194,8 @@ void vss_init(int afs_socket, struct sched *s) } vsst->task = task_register(&(struct task_info) { .name = "vss", - .pre_select = vss_pre_select, - .post_select = vss_post_select, + .pre_monitor = vss_pre_monitor, + .post_monitor = vss_post_monitor, .context = vsst, }, s); } diff --git a/wav_filter.c b/wav_filter.c index e749160d..692306b5 100644 --- a/wav_filter.c +++ b/wav_filter.c @@ -58,7 +58,7 @@ static void wav_open(struct filter_node *fn) *bof = 1; } -static void wav_pre_select(struct sched *s, void *context) +static void wav_pre_monitor(struct sched *s, void *context) { struct filter_node *fn = context; size_t iqs = btr_get_input_queue_size(fn->btrn); @@ -68,7 +68,7 @@ static void wav_pre_select(struct sched *s, void *context) sched_min_delay(s); } -static int wav_post_select(__a_unused struct sched *s, void *context) +static int wav_post_monitor(__a_unused struct sched *s, void *context) { struct filter_node *fn = context; struct btr_node *btrn = fn->btrn; @@ -118,6 +118,6 @@ err: const struct filter lsg_filter_cmd_com_wav_user_data = { .close = wav_close, .open = wav_open, - .pre_select = wav_pre_select, - .post_select = wav_post_select, + .pre_monitor = wav_pre_monitor, + .post_monitor = wav_post_monitor, }; diff --git a/wmadec_filter.c b/wmadec_filter.c index edf50cb0..48160005 100644 --- a/wmadec_filter.c +++ b/wmadec_filter.c @@ -1159,7 +1159,7 @@ static int wmadec_execute(struct btr_node *btrn, const char *cmd, char **result) #define WMA_OUTPUT_BUFFER_SIZE (128 * 1024) -static int wmadec_post_select(__a_unused struct sched *s, void *context) +static int wmadec_post_monitor(__a_unused struct sched *s, void *context) { struct filter_node *fn = context; int ret, converted, out_size; @@ -1229,6 +1229,6 @@ const struct filter lsg_filter_cmd_com_wmadec_user_data = { .open = wmadec_open, .close = wmadec_close, .execute = wmadec_execute, - .pre_select = generic_filter_pre_select, - .post_select = wmadec_post_select, + .pre_monitor = generic_filter_pre_monitor, + .post_monitor = wmadec_post_monitor, }; diff --git a/write.c b/write.c index 177b2e66..9e2de3d8 100644 --- a/write.c +++ b/write.c @@ -54,16 +54,16 @@ struct write_task { struct check_wav_context *cwc; }; -static void write_pre_select(struct sched *s, void *context) +static void write_pre_monitor(struct sched *s, void *context) { struct write_task *wt = context; - check_wav_pre_select(s, wt->cwc); + check_wav_pre_monitor(s, wt->cwc); } -static int write_post_select(__a_unused struct sched *s, void *context) +static int write_post_monitor(__a_unused struct sched *s, void *context) { struct write_task *wt = context; - return check_wav_post_select(wt->cwc); + return check_wav_post_monitor(wt->cwc); } static int setup_and_schedule(struct lls_parse_result *lpr) @@ -83,8 +83,8 @@ static int setup_and_schedule(struct lls_parse_result *lpr) wt.cwc = check_wav_init(sit.btrn, NULL, &wp, &cw_btrn); wt.task = task_register(&(struct task_info) { .name = "write", - .pre_select = write_pre_select, - .post_select = write_post_select, + .pre_monitor = write_pre_monitor, + .post_monitor = write_post_monitor, .context = &wt, }, &s); diff --git a/write.h b/write.h index f654c7e9..35a8d29f 100644 --- a/write.h +++ b/write.h @@ -34,9 +34,9 @@ struct writer_node { */ struct writer { /** Ask the scheduler to check whether data can be written. */ - void (*pre_select)(struct sched *s, void *context); + void (*pre_monitor)(struct sched *s, void *context); /** Write audio data. */ - int (*post_select)(struct sched *s, void *context); + int (*post_monitor)(struct sched *s, void *context); /** * Close one instance of the writer. * diff --git a/write_common.c b/write_common.c index 41c3eb23..806d682f 100644 --- a/write_common.c +++ b/write_common.c @@ -139,8 +139,8 @@ void register_writer_node(struct writer_node *wn, struct btr_node *parent, .handler = w->execute, .context = wn)); wn->task = task_register(&(struct task_info) { .name = writer_name(wn->wid), - .pre_select = w->pre_select, - .post_select = w->post_select, + .pre_monitor = w->pre_monitor, + .post_monitor = w->post_monitor, .context = wn, }, s); } -- 2.39.2