am b3db7764: Merge "name the arc4random structure mappings"

* commit 'b3db7764d0757392c73c716423f49dc0809c5a23':
  name the arc4random structure mappings
This commit is contained in:
Elliott Hughes 2015-08-04 01:13:13 +00:00 committed by Android Git Automerger
commit 711d7b9f90

View File

@ -27,6 +27,8 @@
#include <pthread.h> #include <pthread.h>
#include <signal.h> #include <signal.h>
#include "private/bionic_prctl.h"
// Android gets these from "thread_private.h". // Android gets these from "thread_private.h".
#include "thread_private.h" #include "thread_private.h"
//static pthread_mutex_t arc4random_mtx = PTHREAD_MUTEX_INITIALIZER; //static pthread_mutex_t arc4random_mtx = PTHREAD_MUTEX_INITIALIZER;
@ -76,12 +78,18 @@ _rs_allocate(struct _rs **rsp, struct _rsx **rsxp)
MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED)
return (-1); return (-1);
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, *rsp, sizeof(**rsp),
"arc4random _rs structure");
if ((*rsxp = mmap(NULL, sizeof(**rsxp), PROT_READ|PROT_WRITE, if ((*rsxp = mmap(NULL, sizeof(**rsxp), PROT_READ|PROT_WRITE,
MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) { MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) {
munmap(*rsxp, sizeof(**rsxp)); munmap(*rsxp, sizeof(**rsxp));
return (-1); return (-1);
} }
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, *rsxp, sizeof(**rsxp),
"arc4random _rsx structure");
_ARC4_ATFORK(_rs_forkhandler); _ARC4_ATFORK(_rs_forkhandler);
return (0); return (0);
} }