"Fossies" - the Fresh Open Source Software Archive

Member "fuse-3.2.1/lib/fuse_loop.c" (14 Nov 2017, 893 Bytes) of package /linux/misc/fuse-3.2.1.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "fuse_loop.c" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 3.1.1_vs_3.2.0.

    1 /*
    2   FUSE: Filesystem in Userspace
    3   Copyright (C) 2001-2007  Miklos Szeredi <miklos@szeredi.hu>
    4 
    5   Implementation of the single-threaded FUSE session loop.
    6 
    7   This program can be distributed under the terms of the GNU LGPLv2.
    8   See the file COPYING.LIB
    9 */
   10 
   11 #include "config.h"
   12 #include "fuse_lowlevel.h"
   13 #include "fuse_i.h"
   14 
   15 #include <stdio.h>
   16 #include <stdlib.h>
   17 #include <errno.h>
   18 
   19 int fuse_session_loop(struct fuse_session *se)
   20 {
   21     int res = 0;
   22     struct fuse_buf fbuf = {
   23         .mem = NULL,
   24     };
   25 
   26     while (!fuse_session_exited(se)) {
   27         res = fuse_session_receive_buf_int(se, &fbuf, NULL);
   28 
   29         if (res == -EINTR)
   30             continue;
   31         if (res <= 0)
   32             break;
   33 
   34         fuse_session_process_buf_int(se, &fbuf, NULL);
   35     }
   36 
   37     free(fbuf.mem);
   38     if(res > 0)
   39         /* No error, just the length of the most recently read
   40            request */
   41         res = 0;
   42     if(se->error != 0)
   43         res = se->error;
   44     fuse_session_reset(se);
   45     return res;
   46 }