Logo Search packages:      
Sourcecode: fuse version File versions  Download package

int fuse_session_loop ( struct fuse_session *  se  ) 

Enter a single threaded event loop

Parameters:
se the session
Returns:
0 on success, -1 on error

Definition at line 15 of file fuse_loop.c.

References fuse_chan_bufsize(), fuse_chan_recv(), fuse_session_exited(), fuse_session_loop(), fuse_session_next_chan(), fuse_session_process(), and fuse_session_reset().

Referenced by fuse_loop(), and fuse_session_loop().

{
      int res = 0;
      struct fuse_chan *ch = fuse_session_next_chan(se, NULL);
      size_t bufsize = fuse_chan_bufsize(ch);
      char *buf = (char *) malloc(bufsize);
      if (!buf) {
            fprintf(stderr, "fuse: failed to allocate read buffer\n");
            return -1;
      }

      while (!fuse_session_exited(se)) {
            struct fuse_chan *tmpch = ch;
            res = fuse_chan_recv(&tmpch, buf, bufsize);
            if (res == -EINTR)
                  continue;
            if (res <= 0)
                  break;
            fuse_session_process(se, buf, res, tmpch);
      }

      free(buf);
      fuse_session_reset(se);
      return res < 0 ? -1 : 0;
}


Generated by  Doxygen 1.6.0   Back to index