#include "afh.h"
#include "afs.h"
#include "server.h"
-#include <dirent.h> /* readdir() */
-#include <sys/mman.h>
-#include <sys/time.h>
#include "net.h"
#include "ipc.h"
#include "list.h"
* command. This function allows to pass such a structure together with a list
* of further arguments (often a list of audio files) to the parent process.
*
+ * \return The return value of the underlying call to \ref
+ * send_callback_request().
+ *
* \sa send_standard_callback_request(), send_callback_request().
*/
int send_option_arg_callback_request(struct osl_object *options,
continue;
if (ret)
return -E_FNMATCH;
- return pmd->action(pmd->table, row, name, pmd->data);
+ ret = pmd->action(pmd->table, row, name, pmd->data);
+ if (ret >= 0)
+ pmd->num_matches++;
+ return ret;
}
return 1;
}
static void com_select_callback(int fd, const struct osl_object *query)
{
struct para_buffer pb = {
- .max_size = SHMMAX,
+ .max_size = shm_get_shmmax(),
.private_data = &fd,
.max_size_handler = pass_buffer_as_shm
};
}
PARA_EMERG_LOG("terminating on signal %d\n", signum);
shutdown:
- sched_shutdown();
+ sched_shutdown(s);
t->error = -E_AFS_SIGNAL;
}
-static void register_signal_task(void)
+static void register_signal_task(struct sched *s)
{
struct signal_task *st = &signal_task_struct;
st->task.pre_select = signal_pre_select;
st->task.post_select = afs_signal_post_select;
sprintf(st->task.status, "signal task");
- register_task(&st->task);
+ register_task(s, &st->task);
}
static struct list_head afs_client_list;
ret = execute_server_command(&s->rfds);
if (ret < 0) {
PARA_EMERG_LOG("%s\n", para_strerror(-ret));
- sched_shutdown();
+ sched_shutdown(s);
return;
}
/* Check the list of connected clients. */
para_list_add(&client->node, &afs_client_list);
}
-static void register_command_task(uint32_t cookie)
+static void register_command_task(uint32_t cookie, struct sched *s)
{
struct command_task *ct = &command_task_struct;
ct->fd = setup_command_socket_or_die();
ct->task.pre_select = command_pre_select;
ct->task.post_select = command_post_select;
sprintf(ct->task.status, "afs command task");
- register_task(&ct->task);
+ register_task(s, &ct->task);
}
/**
static struct sched s;
int i, ret;
- register_signal_task();
+ register_signal_task(&s);
INIT_LIST_HEAD(&afs_client_list);
for (i = 0; i < NUM_AFS_TABLES; i++)
afs_tables[i].init(&afs_tables[i]);
PARA_INFO_LOG("server_socket: %d, afs_socket_cookie: %u\n",
server_socket, (unsigned) cookie);
init_admissible_files(conf.afs_initial_mode_arg);
- register_command_task(cookie);
+ register_command_task(cookie, &s);
s.default_timeout.tv_sec = 0;
s.default_timeout.tv_usec = 999 * 1000;
ret = schedule(&s);
* \param pb Unused.
* \param data Unused.
*
- * This table does not honor events.
+ * \return The images table does not honor events, so this handler always
+ * returns success.
*/
-int images_event_handler(__a_unused enum afs_events event,
+__a_const int images_event_handler(__a_unused enum afs_events event,
__a_unused struct para_buffer *pb, __a_unused void *data)
{
return 1;
* \param pb Unused.
* \param data Unused.
*
- * This table does not honor events.
+ * \return The lyrics table does not honor events, so this handler always
+ * returns success.
*/
-int lyrics_event_handler(__a_unused enum afs_events event,
+__a_const int lyrics_event_handler(__a_unused enum afs_events event,
__a_unused struct para_buffer *pb, __a_unused void *data)
{
return 1;