Skip to content

Commit

Permalink
Define new enum types for privHelperServer to handle requests to star…
Browse files Browse the repository at this point in the history
…t/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
  • Loading branch information
lXXXw authored and facebook-github-bot committed Feb 11, 2025
1 parent 6fc37ff commit f76279b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions eden/fs/privhelper/PrivHelperConn.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -280,6 +282,12 @@ struct formatter<facebook::eden::PrivHelperConn::MsgType>
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";
}
Expand Down
2 changes: 2 additions & 0 deletions eden/fs/privhelper/PrivHelperServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f76279b

Please sign in to comment.