DevinLeamy commented on code in PR #501:
URL: https://github.com/apache/mesos/pull/501#discussion_r1518185616
##########
src/linux/ebpf.cpp:
##########
@@ -14,4 +14,126 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#include "linux/ebpf.hpp"
\ No newline at end of file
+#include "linux/ebpf.hpp"
+
+#include <linux/bpf.h>
+#include <sys/syscall.h>
+
+#include <string>
+#include <vector>
+
+#include "stout/error.hpp"
+#include "stout/try.hpp"
+
+using std::string;
+using std::vector;
+
+namespace ebpf {
+
+#define syscall_bpf(cmd, attr, size) (int) syscall(__NR_bpf, cmd, attr, size);
+
+// Wrapper around the BPF syscall.
+Try<int> bpf(int cmd, bpf_attr* attr, size_t size)
+{
+ int result = syscall_bpf(cmd, attr, size);
+ if (result == -1) {
+ ErrnoError error;
+ return Error("BPF syscall failed with error '" + error.message + "'");
Review Comment:
Make sense.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]