Unverified Commit 5f419538 authored by Tommaso Tocci's avatar Tommaso Tocci
Browse files

Disable syscalls logging by default

The new `LOG_SYSCALLS` Cmake flag can be used to enable verbose logging of
system calls interception.
parent 857f8eaf
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -106,6 +106,9 @@ message(STATUS "RPC protocol: '${RPC_PROTOCOL}'")
option(USE_SHM "Use shared memory for intra-node communication" ON)
message(STATUS "Shared-memory communication: ${USE_SHM}")

option(LOG_SYSCALLS "Enable verbose logging for syscalls interception" OFF)
message(STATUS "Syscall logging: ${LOG_SYSCALLS}")

option(SYMLINK_SUPPORT "Compile with support for symlinks" ON)
if(SYMLINK_SUPPORT)
    add_definitions(-DHAS_SYMLINKS)
+2 −0
Original line number Diff line number Diff line
@@ -69,4 +69,6 @@
#define DEFAULT_PRELOAD_LOG_LEVEL 4 // info
#define DEFAULT_DAEMON_LOG_LEVEL 4 // info

#cmakedefine01 LOG_SYSCALLS

#endif //FS_CONFIGURE_H
+4 −3
Original line number Diff line number Diff line
@@ -14,8 +14,9 @@
#include "client/intercept.hpp"
#include "client/preload.hpp"
#include "client/hooks.hpp"
#include "global/configure.hpp"

#ifndef NDEBUG
#if LOG_SYSCALLS
#include "client/syscall_names.hpp"
#endif

@@ -303,13 +304,13 @@ static inline int hook(long syscall_number,
         * as would normally happen.
         */

        #ifndef NDEBUG
        #if LOG_SYSCALLS
        CTX->log()->trace("Syscall [{}, {}]  Passthrough", syscall_names[syscall_number], syscall_number);
        #endif
        return NOT_HOOKED;
    }

    #ifndef NDEBUG
    #if LOG_SYSCALLS
    CTX->log()->trace("Syscall [{}, {}]  Intercepted", syscall_names[syscall_number], syscall_number);
    #endif
    return HOOKED;
+5 −0
Original line number Diff line number Diff line
@@ -321,6 +321,11 @@ int main(int argc, const char* argv[]) {
        cout << "Shared-memory comm: ON" << endl;
#else
        cout << "Shared-memory comm: OFF" << endl;
#endif
#if LOG_SYSCALLS
        cout << "Syscalls logging: ON" << endl;
#else
        cout << "Syscalls logging: OFF" << endl;
#endif
        cout << "Chunk size: " << CHUNKSIZE << " bytes" << endl;
        return 0;