libfuse: remove fuse_chan_bufsize()
[fuse.git] / lib / fuse_loop.c
blob7ddf2f982ba46cd0de40dc4bd351108eb9d4d311
1 /*
2 FUSE: Filesystem in Userspace
3 Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
5 This program can be distributed under the terms of the GNU LGPLv2.
6 See the file COPYING.LIB
7 */
9 #include "fuse_lowlevel.h"
11 #include <stdio.h>
12 #include <stdlib.h>
13 #include <errno.h>
15 int fuse_session_loop(struct fuse_session *se)
17 int res = 0;
18 struct fuse_chan *ch = fuse_session_chan(se);
19 struct fuse_buf fbuf = {
20 .mem = NULL,
23 while (!fuse_session_exited(se)) {
24 res = fuse_session_receive_buf(se, &fbuf, ch);
26 if (res == -EINTR)
27 continue;
28 if (res <= 0)
29 break;
31 fuse_session_process_buf(se, &fbuf, ch);
34 free(fbuf.mem);
35 fuse_session_reset(se);
36 return res < 0 ? -1 : 0;