MCPcopy Create free account
hub / github.com/cvmfs/cvmfs / FuseMain

Function FuseMain

cvmfs/loader.cc:629–1443  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

627using namespace loader; // NOLINT(build/namespaces)
628
629int FuseMain(int argc, char *argv[]) {
630 // Set a decent umask for new files (no write access to group/everyone).
631 // We want to allow group write access for the talk-socket.
632 umask(007);
633 // SIGUSR1 is used for the stop_and_go mode during reload
634 BlockSignal(SIGUSR1);
635
636 int retval;
637
638 // Jump into alternative process flavors (e.g. shared cache manager)
639 // We are here due to a fork+execve (ManagedExec in util.cc) or due to
640 // utility calls of cvmfs2
641 if ((argc > 1) && (strstr(argv[1], "__") == argv[1])) {
642 if (string(argv[1]) == string("__RELOAD__")) {
643 if (argc < 3)
644 return 1;
645 bool stop_and_go = false;
646 if ((argc > 3) && (string(argv[3]) == "stop_and_go"))
647 stop_and_go = true;
648
649 // always last param of the cvmfs2 __RELOAD__ command
650 // check if debug mode is requested
651 // NOTE:
652 // debug mode is decided based on CVMFS_DEBUGLOG being set or not
653 // this means: reloading is now always based on CVMFS_DEBUGLOG, and
654 // reload ignores the current state
655 //
656 // if you mount with debug but do not set CVMFS_DEBUGLOG and reload,
657 // debug will be turned off
658 if (std::string(argv[argc - 1]) == std::string("--debug")) {
659 debug_mode_ = true;
660 } else {
661 debug_mode_ = false;
662 }
663 retval = loader_talk::MainReload(argv[2], stop_and_go, debug_mode_);
664
665 if ((retval != 0) && (stop_and_go)) {
666 CreateFile(string(argv[2]) + ".paused.crashed", 0600);
667 }
668 return retval;
669 }
670
671 if (string(argv[1]) == string("__MK_ALIEN_CACHE__")) {
672 if (argc < 5)
673 return 1;
674 const string alien_cache_dir = argv[2];
675 const sanitizer::PositiveIntegerSanitizer sanitizer;
676 if (!sanitizer.IsValid(argv[3]) || !sanitizer.IsValid(argv[4]))
677 return 1;
678 const uid_t uid_owner = String2Uint64(argv[3]);
679 const gid_t gid_owner = String2Uint64(argv[4]);
680
681 int retval = MkdirDeep(alien_cache_dir, 0770);
682 if (!retval) {
683 LogCvmfs(kLogCvmfs, kLogStderr, "Failed to create %s",
684 alien_cache_dir.c_str());
685 return 1;
686 }

Callers

nothing calls this directly

Calls 15

BlockSignalFunction · 0.85
MainReloadFunction · 0.85
CreateFileFunction · 0.85
String2Uint64Function · 0.85
MkdirDeepFunction · 0.85
LogCvmfsFunction · 0.85
SwitchCredentialsFunction · 0.85
MakeCacheDirectoriesFunction · 0.85
LoadLibraryFunction · 0.85
ParseCmdLineFunction · 0.85
SplitStringFunction · 0.85
TrimFunction · 0.85

Tested by

no test coverage detected