]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - grab_client.c
paraslash 0.7.3
[paraslash.git] / grab_client.c
index 11fff4cc985db6716d14ee663f59facf764a2eeb..1019e579a39d8559b2aecc658c7651fd6b7704dc 100644 (file)
@@ -1,14 +1,9 @@
-/*
- * Copyright (C) 2006 Andre Noll <maan@tuebingen.mpg.de>
- *
- * Licensed under the GPL v2. For licencing details see COPYING.
- */
+/* Copyright (C) 2006 Andre Noll <maan@tuebingen.mpg.de>, see file COPYING. */
 
 /** \file grab_client.c Functions for grabbing the audio stream. */
 
 #include <regex.h>
 #include <sys/types.h>
 
 /** \file grab_client.c Functions for grabbing the audio stream. */
 
 #include <regex.h>
 #include <sys/types.h>
-#include <inttypes.h>
 #include <lopsub.h>
 
 #include "audiod_cmd.lsg.h"
 #include <lopsub.h>
 
 #include "audiod_cmd.lsg.h"
@@ -94,7 +89,7 @@ err:
        return -E_GC_WRITE;
 }
 
        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);
 {
        struct grab_client *gc = context;
        int ret = btr_node_status(gc->btrn, 0, BTR_NT_LEAF);
@@ -103,14 +98,14 @@ static void gc_pre_select(struct sched *s, void *context)
                return;
        if (ret < 0)
                sched_min_delay(s);
                return;
        if (ret < 0)
                sched_min_delay(s);
-       para_fd_set(gc->fd, &s->wfds, &s->max_fileno);
+       sched_monitor_writefd(gc->fd, s);
 }
 
 /*
 }
 
 /*
- * 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.
  */
  * 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.
 
 /**
  * Move a grab client to the active list and start it.
@@ -134,8 +129,8 @@ static void gc_activate(struct grab_client *gc, struct sched *s)
 
        gc->task = task_register(&(struct task_info) {
                .name = name,
 
        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);
 }
                .context = gc,
        }, s);
 }
@@ -176,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
                /*
                 * 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;
                 */
                close(gc->fd);
                gc->fd = -1;
@@ -187,7 +182,7 @@ static int gc_close(struct grab_client *gc, int err)
        return 0;
 }
 
        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;
 {
        struct grab_client *gc = context;
        struct btr_node *btrn = gc->btrn;
@@ -266,7 +261,7 @@ static int gc_check_args(struct lls_parse_result *lpr, struct grab_client *gc)
 int grab_client_new(int fd, struct lls_parse_result *lpr, struct sched *s)
 {
        int ret;
 int grab_client_new(int fd, struct lls_parse_result *lpr, struct sched *s)
 {
        int ret;
-       struct grab_client *gc = para_calloc(sizeof(struct grab_client));
+       struct grab_client *gc = zalloc(sizeof(struct grab_client));
 
        ret = gc_check_args(lpr, gc);
        if (ret < 0)
 
        ret = gc_check_args(lpr, gc);
        if (ret < 0)