libfuse/lib/fuse_loop.c
Bernd Schubert db35a37def Install a the configure_file (config.h) and use in headers
This addresses: https://github.com/libfuse/libfuse/issues/724

HAVE_LIBC_VERSIONED_SYMBOLS configures the library if to use
versioned symbols and is set at meson configuration time.
External filesystems (the main target, actually)
include fuse headers and the preprocessor
then acts on HAVE_LIBC_VERSIONED_SYMBOLS. Problem was now that
'config.h' was not distributed with libfuse and so
HAVE_LIBC_VERSIONED_SYMBOLS was never defined with external
tools and the preprocessor did the wrong decision.

This commit also increases the the minimal meson version,
as this depends on meson feature only available in 0.50

<quote 'meson' >
WARNING: Project specifies a minimum meson_
version '>= 0.42' but uses features which were added
 in newer versions:
 * 0.50.0: {'install arg in configure_file'}
</quote>

Additionally the config file has been renamed to "fuse_config.h"
to avoid clashes - 'config.h' is not very specific.
2023-01-28 09:35:34 +00:00

47 lines
898 B
C

/*
FUSE: Filesystem in Userspace
Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
Implementation of the single-threaded FUSE session loop.
This program can be distributed under the terms of the GNU LGPLv2.
See the file COPYING.LIB
*/
#include "fuse_config.h"
#include "fuse_lowlevel.h"
#include "fuse_i.h"
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
int fuse_session_loop(struct fuse_session *se)
{
int res = 0;
struct fuse_buf fbuf = {
.mem = NULL,
};
while (!fuse_session_exited(se)) {
res = fuse_session_receive_buf_int(se, &fbuf, NULL);
if (res == -EINTR)
continue;
if (res <= 0)
break;
fuse_session_process_buf_int(se, &fbuf, NULL);
}
free(fbuf.mem);
if(res > 0)
/* No error, just the length of the most recently read
request */
res = 0;
if(se->error != 0)
res = se->error;
fuse_session_reset(se);
return res;
}