src/fifo.c
author Tero Marttila <terom@fixme.fi>
Tue, 28 Apr 2009 23:11:06 +0300
branchnew-transport
changeset 161 d229e4668476
parent 157 1e5674d0eec4
child 176 6750d50ee8cd
permissions -rw-r--r--
amend d3e253d7281a, also note that it fixed other bugs with transport_fd
157
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
     1
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
     2
#include "fifo.h"
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
     3
#include "transport_fd.h"
118
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     4
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     5
#include <stdlib.h>
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     6
#include <sys/types.h>
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     7
#include <sys/stat.h>
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     8
#include <fcntl.h>
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     9
#include <string.h>
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    10
157
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
    11
/**
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
    12
 * Our transport_type
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
    13
 */
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
    14
extern const struct transport_type fifo_type;
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
    15
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
    16
/**
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
    17
 * The fifo state
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
    18
 */
118
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    19
struct fifo {
157
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
    20
    /** The FD-based state */
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
    21
    struct transport_fd base_fd;
118
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    22
    
157
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
    23
    /** Path to the fifo */
118
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    24
    char *path;
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    25
};
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    26
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    27
/**
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    28
 * Get a sock_fd pointer from a sock_fifo pointer
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    29
 */
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    30
#define FIFO_FD(sock_ptr) (&(sock_ptr)->base_fd)
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    31
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    32
/**
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    33
 * Get a sock_base pointer from a sock_fifo pointer
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    34
 */
157
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
    35
#define FIFO_TRANSPORT(sock_ptr) TRANSPORT_FD_BASE(FIFO_FD(sock_ptr))
118
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    36
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    37
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    38
/**
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    39
 * (re)open the fifo, closing it if already open, and keeping any event callbacks registered.
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    40
 */
157
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
    41
static err_t fifo_open (struct fifo *fifo, error_t *err)
118
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    42
{
157
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
    43
    int _fd;
118
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    44
157
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
    45
    // open(2) the path in non-blocking read-only mode
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
    46
    if ((_fd = open(fifo->path, O_RDONLY | O_NONBLOCK)) < 0)
118
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    47
        RETURN_SET_ERROR_ERRNO(err, ERR_OPEN);
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    48
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    49
    // set the new fd
157
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
    50
    if ((ERROR_CODE(err) = transport_fd_set(FIFO_FD(fifo), _fd)))
118
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    51
        return ERROR_CODE(err);
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    52
    
157
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
    53
    // use default transport event-based behaviour
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
    54
    if ((ERROR_CODE(err) = transport_fd_defaults(FIFO_FD(fifo))))
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
    55
        return ERROR_CODE(err);
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
    56
118
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    57
    // ok
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    58
    return SUCCESS;
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    59
}
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    60
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    61
/**
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    62
 * Destroy the fifo, releasing all resources
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    63
 */
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    64
static void fifo_destroy (struct fifo *fifo)
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    65
{
157
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
    66
    // destroy base
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
    67
    transport_fd_destroy(FIFO_FD(fifo));
118
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    68
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    69
    // release the path
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    70
    free(fifo->path);
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    71
}
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    72
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    73
/**
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    74
 * sock_stream_methods::read implementation.
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    75
 *
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    76
 * Try and do a normal sock_fd_read call, but re-open with EAGAIN on EOF
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    77
 */
157
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
    78
err_t fifo_read (transport_t *transport, void *buf, size_t *len, struct error_info *err)
118
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    79
{
157
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
    80
    struct fifo *fifo = transport_check(transport, &fifo_type);
118
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    81
157
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
    82
    // trap READ_EOF
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
    83
    if (transport_fd_methods_read(transport, buf, len, err) != ERR_EOF)
118
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    84
        return ERROR_CODE(err);
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    85
    
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    86
    // re-open it
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    87
    // XXX: re-add events?
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    88
    if (fifo_open(fifo, err))
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    89
        goto error;
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    90
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    91
    // ok, act as if it was EAGAIN
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    92
    *len = 0;
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    93
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    94
    return SUCCESS;
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    95
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    96
error:
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    97
    return ERROR_CODE(err);
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    98
}
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    99
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   100
/**
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   101
 * sock_stream_methods::release implementation
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   102
 */
157
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
   103
static void _fifo_destroy (transport_t *transport)
118
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   104
{
157
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
   105
    struct fifo *fifo = transport_check(transport, &fifo_type);
118
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   106
    
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   107
    fifo_destroy(fifo);
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   108
}
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   109
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   110
/*
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   111
 * Our sock_stream_type
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   112
 */
157
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
   113
const struct transport_type fifo_type = {
161
d229e4668476 amend d3e253d7281a, also note that it fixed other bugs with transport_fd
Tero Marttila <terom@fixme.fi>
parents: 157
diff changeset
   114
    .parent                 = &transport_fd_type,
118
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   115
    .methods                = {
157
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
   116
        .read               = fifo_read,
118
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   117
        .write              = NULL,
157
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
   118
        .events             = transport_fd_methods_events,
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
   119
        .destroy            = _fifo_destroy,
118
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   120
    },
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   121
};
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   122
157
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
   123
err_t fifo_open_read (struct transport_info *transport_info, transport_t **transport_ptr, struct event_base *ev_base,
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
   124
        const char *path, error_t *err)
118
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   125
{
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   126
    struct fifo *fifo;
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   127
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   128
    // alloc
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   129
    if ((fifo = calloc(1, sizeof(*fifo))) == NULL)
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   130
        return SET_ERROR(err, ERR_CALLOC);
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   131
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   132
    // copy the path
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   133
    if ((fifo->path = strdup(path)) == NULL)
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   134
        return SET_ERROR(err, ERR_STRDUP);
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   135
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   136
    // init
157
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
   137
    transport_init(FIFO_TRANSPORT(fifo), &fifo_type, transport_info);
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
   138
    transport_fd_init(FIFO_FD(fifo), ev_base, TRANSPORT_FD_INVALID);
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
   139
    
118
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   140
    // open the fifo
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   141
    if (fifo_open(fifo, err))
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   142
        goto error;
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   143
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   144
    // ok
157
1e5674d0eec4 fixed fifo
Tero Marttila <terom@fixme.fi>
parents: 139
diff changeset
   145
    *transport_ptr = FIFO_TRANSPORT(fifo);
118
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   146
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   147
    return SUCCESS;
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   148
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   149
error:
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   150
    // cleanup
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   151
    fifo_destroy(fifo);
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   152
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   153
    return ERROR_CODE(err);
05b8d5150313 implement fifo (sock_fifo.c) and test_fifo
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   154
}