Merge "Clean up various warnings in bionic."

This commit is contained in:
Elliott Hughes 2014-02-18 20:05:16 +00:00 committed by Gerrit Code Review
commit cd6748cdd7
7 changed files with 33 additions and 25 deletions

View file

@ -67,13 +67,11 @@ libc_common_src_files := \
bionic/md5.c \
bionic/memmem.c \
bionic/memswap.c \
bionic/name_mem.c \
bionic/pathconf.c \
bionic/perror.c \
bionic/ptsname.c \
bionic/ptsname_r.c \
bionic/pututline.c \
bionic/reboot.c \
bionic/recv.c \
bionic/sched_cpualloc.c \
bionic/sched_cpucount.c \
@ -212,6 +210,7 @@ libc_bionic_src_files := \
bionic/abort.cpp \
bionic/access.cpp \
bionic/assert.cpp \
bionic/__bionic_name_mem.cpp \
bionic/bionic_time_conversions.cpp \
bionic/brk.cpp \
bionic/chmod.cpp \
@ -268,6 +267,7 @@ libc_bionic_src_files := \
bionic/ptrace.cpp \
bionic/raise.cpp \
bionic/readlink.cpp \
bionic/reboot.cpp \
bionic/rename.cpp \
bionic/rmdir.cpp \
bionic/sbrk.cpp \

View file

@ -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);
}

View file

@ -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);
}

View file

@ -25,6 +25,7 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _BIONIC_NAME_MEM_H
#define _BIONIC_NAME_MEM_H
@ -33,7 +34,7 @@
__BEGIN_DECLS
int __bionic_name_mem(void *addr, size_t len, const char *name);
int __bionic_name_mem(void* addr, size_t len, const char* name);
__END_DECLS

View file

@ -47,4 +47,8 @@
/* This one is only needed as long as we have a mix of OpenBSD and FreeBSD stdio. */
#define _sseek __sseek
/* This is in BSD's <stdlib.h>. */
#include <stdint.h>
extern uint32_t arc4random_uniform(uint32_t upper_bound);
#endif

View file

@ -19,6 +19,7 @@
#include "namespace.h"
#include <sys/cdefs.h>
#include <time.h>
#include "private/arpa_nameser.h"
#define ISC_FORMAT_PRINTF(a,b) __printflike(a,b)

View file

@ -23,4 +23,7 @@
#define __strong_reference(sym,aliassym) \
extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)))
/* digittoint is in BSD's <ctype.h>. */
int digittoint(char ch);
#endif