Add unit test for shared/unshared interface quotas
Test: as follows
- built
- flashed
- booted
- "runtest -x .../netd_unit_test.cpp" passes
Bug: 28362720
Bug: 38143143
Change-Id: I0b962898f9e3d7e86d5c0d0d01b79b3e3543b5ee
diff --git a/libnetdutils/include/netdutils/UniqueFile.h b/libnetdutils/include/netdutils/UniqueFile.h
new file mode 100644
index 0000000..53552d2
--- /dev/null
+++ b/libnetdutils/include/netdutils/UniqueFile.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef NETDUTILS_UNIQUEFILE_H
+#define NETDUTILS_UNIQUEFILE_H
+
+#include <stdio.h>
+#include <memory>
+
+#include "netdutils/Fd.h"
+
+namespace android {
+namespace netdutils {
+
+struct UniqueFileDtor {
+ void operator()(FILE* file);
+};
+
+using UniqueFile = std::unique_ptr<FILE, UniqueFileDtor>;
+
+} // namespace netdutils
+} // namespace android
+
+#endif /* NETDUTILS_UNIQUEFILE_H */