From f76279bd4873f5413f527b3b63b2ea58dbc51b81 Mon Sep 17 00:00:00 2001 From: Xiaowei Lu Date: Tue, 11 Feb 2025 14:53:49 -0800 Subject: [PATCH] Define new enum types for privHelperServer to handle requests to start/stop FAM Summary: ## This Diff Defined two new enum types to start/stop FAM. These types will be used by privHelperClient to serialize into the requests and by the privHelperServer to decide how to process the requests. ## Context File Access Monitor(FAM) is a tool to monitor file system access, aiming to find out EdenFS crawlers. The tool will be implemented after the toolchain is ready. Before that, we are going to use [this third-party binary](https://github.com/objective-see/FileMonitor). This diff stack focuses on integrating the binary into Eden package and spawn a process from privHelper because of the required privileged permission. Reviewed By: ViniGupta08 Differential Revision: D69340299 fbshipit-source-id: 4cc8176162e7099e4263b9619de3d2a44a60a219 --- eden/fs/privhelper/PrivHelperConn.h | 8 ++++++++ eden/fs/privhelper/PrivHelperServer.cpp | 2 ++ 2 files changed, 10 insertions(+) diff --git a/eden/fs/privhelper/PrivHelperConn.h b/eden/fs/privhelper/PrivHelperConn.h index 741c00f44700f..cc46a41726206 100644 --- a/eden/fs/privhelper/PrivHelperConn.h +++ b/eden/fs/privhelper/PrivHelperConn.h @@ -51,6 +51,8 @@ class PrivHelperConn { REQ_MOUNT_NFS = 11, REQ_UNMOUNT_NFS = 12, REQ_GET_PID = 13, + REQ_START_FAM = 14, + REQ_STOP_FAM = 15, }; // This structure should never change. If fields need to be added to the @@ -280,6 +282,12 @@ struct formatter case facebook::eden::PrivHelperConn::REQ_GET_PID: name = "REQ_GET_PID"; break; + case facebook::eden::PrivHelperConn::REQ_START_FAM: + name = "REQ_START_FAM"; + break; + case facebook::eden::PrivHelperConn::REQ_STOP_FAM: + name = "REQ_STOP_FAM"; + break; default: name = "Unknown PrivHelperConn::MsgType"; } diff --git a/eden/fs/privhelper/PrivHelperServer.cpp b/eden/fs/privhelper/PrivHelperServer.cpp index 0938fc7310cbe..df85ec394e529 100644 --- a/eden/fs/privhelper/PrivHelperServer.cpp +++ b/eden/fs/privhelper/PrivHelperServer.cpp @@ -1373,6 +1373,8 @@ UnixSocket::Message PrivHelperServer::processMessage( return processSetUseEdenFs(cursor, request); case PrivHelperConn::REQ_GET_PID: return processGetPid(); + case PrivHelperConn::REQ_START_FAM: + case PrivHelperConn::REQ_STOP_FAM: case PrivHelperConn::MSG_TYPE_NONE: case PrivHelperConn::RESP_ERROR: break;