Move IPv6 code to InterfaceController.
Bug: 8276725
Change-Id: Ia04fb64d3660eb08d8b32209bf689c5c5e6dd9ac
diff --git a/NetdConstants.cpp b/NetdConstants.cpp
index 9b83125..1ab09a5 100644
--- a/NetdConstants.cpp
+++ b/NetdConstants.cpp
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#include <fcntl.h>
#include <string.h>
#include <sys/wait.h>
@@ -105,3 +106,19 @@
va_end(args);
return res;
}
+
+int writeFile(const char *path, const char *value, int size) {
+ int fd = open(path, O_WRONLY);
+ if (fd < 0) {
+ ALOGE("Failed to open %s: %s", path, strerror(errno));
+ return -1;
+ }
+
+ if (write(fd, value, size) != size) {
+ ALOGE("Failed to write %s: %s", path, strerror(errno));
+ close(fd);
+ return -1;
+ }
+ close(fd);
+ return 0;
+}