2 * Copyright (C) 2015 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License, version 2 only, as
6 * published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 51
15 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #include <common/common.h>
21 #include "stream-fd.h"
23 struct stream_fd
*stream_fd_create(int fd
)
27 sf
= zmalloc(sizeof(*sf
));
31 urcu_ref_init(&sf
->ref
);
37 void stream_fd_get(struct stream_fd
*sf
)
39 urcu_ref_get(&sf
->ref
);
42 static void stream_fd_release(struct urcu_ref
*ref
)
44 struct stream_fd
*sf
= caa_container_of(ref
, struct stream_fd
, ref
);
49 PERROR("Error closing stream FD %d", sf
->fd
);
54 void stream_fd_put(struct stream_fd
*sf
)
59 urcu_ref_put(&sf
->ref
, stream_fd_release
);
This page took 0.032812 seconds and 4 git commands to generate.