aboutsummaryrefslogtreecommitdiffstats
path: root/lib/fuse_signals.c
AgeCommit message (Collapse)AuthorLines
2025-06-27license: s/COPYING/GPL2.txt, s/COPYING.LIB/LGPL2.txtizxl007-1/+1
Signed-off-by: izxl007 <zeng.zheng@zte.com.cn>
2025-06-12fuse_signals.c: fix build warning when HAVE_BACKTRACE is undefinedGeorgi Valkov-0/+2
BT_STACK_SZ and backtrace_buffer are not used when HAVE_BACKTRACE is undefined. Wrap them in #ifdef to avoid a build warning: ../lib/fuse_signals.c:31:14: warning: 'backtrace_buffer' defined but not used [-Wunused-variable] 31 | static void *backtrace_buffer[BT_STACK_SZ]; | ^~~~~~~~~~~~~~~~ Signed-off-by: Georgi Valkov <gvalkov@gmail.com>
2025-04-24Fix multi-threaded fuse session exitBernd Schubert-1/+12
Issue with previous code was that fuse_session_exit() didn't wake up the semaphore in fuse_loop_mt.c. Lock, semaphore and all uses of checking for "exited" are now moved to struct fuse_session to have it available for the signal handler. This also removes internal fuse_session_reset() calls, as that makes testing hard. From git history I also don't see why it was added. Closes: https://github.com/libfuse/libfuse/issues/997 Signed-off-by: Bernd Schubert <bschubert@ddn.com>
2025-04-23signal handlers: Store fuse_session unconditionallyBernd Schubert-4/+9
Commit dae1184 ("Add syslog and fatal signal handler feature") added fuse_set_fail_signal_handlers() which can store "se". But as fuse_set_signal_handlers() also stores the object storing it was made conditionally if not set already. As per https://github.com/libfuse/libfuse/issues/1182 this breaks some applications like osspd, that have multiple sessions and rely on the right order and that the last call of fuse_set_signal_handlers() wins. Special thanks to Sébastien Noel to debug this issue. Closes: https://github.com/libfuse/libfuse/issues/1182 Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
2024-08-02Fix program-path in util/parse-backtrace and dump_stack functionBernd Schubert-3/+0
The option to the path of the binary had been accidentally removed in the scripts that can parse backtraces. The dump_stack() function had left over debug messages.
2024-07-29Gate #include <execinfo.h> behind #ifdef HAVE_BACKTRACENils-1/+4
execinfo.h is unnecessary if HAVE_BACKTRACE is not defined. This increases portability for systems without execinfo.h
2024-07-14Add syslog and fatal signal handler featureBernd Schubert-27/+119
I see random ENOTCONN failures in xfstest generic/013 and generic/014 in my branch, but earliest on the 2nd run - takes ~12hours to get the issue, but then there are no further information logged. ENOTCONN points to a daemon crash - I need backtraces and a core dump. This adds optional handling of fatal signals to print a core dump and optional syslog logging with these new public functions: fuse_set_fail_signal_handlers() In addition to the existing fuse_set_signal_handlers(). This is not enabled together with fuse_set_signal_handlers(), as it is change in behavior and file systems might already have their own fatal handlers. fuse_log_enable_syslog Print logs to syslog instead of stderr fuse_log_close_syslog Close syslog (for now just does closelog()) Code in fuse_signals.c is also updated, to be an array of signals, and setting signal handlers is now down with a for-loop instead of one hand coded set_one_signal_handler() per signal.
2024-03-20Add glibc backtrace to signal handlerBernd Schubert-0/+15
It is very hard to see in github tests what is actually failing with signals - add the gnu-libc backtrace handler.
2023-01-28Install a the configure_file (config.h) and use in headersBernd Schubert-1/+1
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.
2019-09-04Introduce callback for loggingStefan Hajnoczi-2/+2
Introduce an API for custom log handler functions. This allows libfuse applications to send messages to syslog(3) or other logging systems. See include/fuse_log.h for details. Convert libfuse from fprintf(stderr, ...) to log_fuse(level, ...). Most messages are error messages with FUSE_LOG_ERR log level. There are also some debug messages which now use the FUSE_LOG_DEBUG log level. Note that lib/mount_util.c is used by both libfuse and fusermount3. Since fusermount3 does not link against libfuse, we cannot call fuse_log() from lib/mount_util.c. This file will continue to use fprintf(stderr, ...) until someone figures out how to split it up. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2018-04-13Drop unneeded void cast for actually used local variableTomohiro Kusumi-1/+0
`int sig` is acutually used, so `(void) sig;` is unneeded.
2017-05-24fuse_signals.c: use new do_nothing function instead of SIG_IGNNikolaus Rath-2/+12
Fixes: #160.
2016-11-29Return signal value if session loop is terminated by signal and improve ↵Nikolaus Rath-1/+9
documentation
2016-10-28Clean-up doxygen documentationNikolaus Rath-2/+0
Fixes: #81.
2016-10-02Extended per-file comments.Nikolaus Rath-0/+2
This should make more clear what file contains code for what purpose.
2016-03-29Whitespace cleanup.Nikolaus Rath-1/+0
Applied (whitespace-cleanup) to each file. Having whitespace changes in the VCS is ugly, but it ensures that in the future committers can run this function to *avoid* commiting any whitespace.
2015-02-26libfuse: fix fuse_remove_signal_handlers()Miklos Szeredi-11/+11
to properly restore the default signal handler. Reported by: Chris Johnson <johnsocg@gmail.com>
2013-07-24libfuse: remove "-D_FILE_OFFSET_BITS=64" from fuse.pcMiklos Szeredi-0/+1
add AC_SYS_LARGEFILE to your configure.ac instead.
2013-07-02rewrote c++ style comments to c style coments mentioned by Miklos SzerediJoachim Schiele-2/+2
2013-06-20- added a doxygen main pageJoachim Schiele-0/+2
- modified all examples to be included in doxygen - modified the API documentation to have more details - added the 490px_FUSE_structure.svg.png (c) wikipedia
2007-12-12change indentingMiklos Szeredi-39/+39
2007-10-16Clarify licence version to be "LGPLv2" for the libraryMiklos Szeredi-1/+1
2007-04-25update copyright datesMiklos Szeredi-1/+1
2006-09-07interrupt supportMiklos Szeredi-2/+2
2006-01-06fixMiklos Szeredi-0/+72