Clean up various warnings in bionic.
Change-Id: Ic57541d0a567fd4ae79f0ad59b2ffde1130eb7d2
diff --git a/libc/bionic/name_mem.c b/libc/bionic/__bionic_name_mem.cpp
similarity index 68%
rename from libc/bionic/name_mem.c
rename to libc/bionic/__bionic_name_mem.cpp
index 69e10c2..72a1d1e 100644
--- a/libc/bionic/name_mem.c
+++ b/libc/bionic/__bionic_name_mem.cpp
@@ -28,26 +28,23 @@
#include "private/bionic_name_mem.h"
-/*
- * Local definitions of custom prctl arguments to set a vma name in some kernels
- */
+#include <sys/prctl.h>
+
+// Local definitions of custom prctl arguments to set a vma name in some kernels.
#define BIONIC_PR_SET_VMA 0x53564d41
#define BIONIC_PR_SET_VMA_ANON_NAME 0
-/*
- * Names a region of memory. The name is expected to show up in /proc/pid/maps
- * and /proc/pid/smaps. There is no guarantee that it will work, and it if it
- * does work it is likely to only work on memory that was allocated with
- * mmap(MAP_ANONYMOUS), and only on regions that are page aligned. name should
- * be a pointer to a string that is valid for as long as the memory is mapped,
- * preferably a compile-time constant string.
- *
- * Returns -1 on error and sets errno. If it returns an error naming page
- * aligned anonymous memory the kernel doesn't support naming, and an alternate
- * method of naming memory should be used (like ashmem).
- */
-int __bionic_name_mem(void *addr, size_t len, const char *name)
-{
- return prctl(BIONIC_PR_SET_VMA, BIONIC_PR_SET_VMA_ANON_NAME,
- addr, len, name);
+// Names a region of memory. The name is expected to show up in /proc/pid/maps
+// and /proc/pid/smaps. There is no guarantee that it will work, and if it
+// does work it is likely to only work on memory that was allocated with
+// mmap(MAP_ANONYMOUS), and only on regions that are page aligned. name should
+// be a pointer to a string that is valid for as long as the memory is mapped,
+// preferably a compile-time constant string.
+//
+// Returns -1 on error and sets errno. If it returns an error naming page
+// aligned anonymous memory the kernel doesn't support naming, and an alternate
+// method of naming memory should be used (like ashmem).
+
+int __bionic_name_mem(void* addr, size_t len, const char* name) {
+ return prctl(BIONIC_PR_SET_VMA, BIONIC_PR_SET_VMA_ANON_NAME, addr, len, name);
}
diff --git a/libc/bionic/reboot.c b/libc/bionic/reboot.cpp
similarity index 90%
rename from libc/bionic/reboot.c
rename to libc/bionic/reboot.cpp
index 0fe8cdc..9cf4411 100644
--- a/libc/bionic/reboot.c
+++ b/libc/bionic/reboot.cpp
@@ -25,10 +25,12 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
+
#include <unistd.h>
#include <sys/reboot.h>
-int reboot (int mode)
-{
- return __reboot( LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, mode, NULL );
+extern "C" int __reboot(int, int, int, void*);
+
+int reboot(int mode) {
+ return __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, mode, NULL);
}