Init
This commit is contained in:
25
lib/csu/common/alloc_pbuf.c
Normal file
25
lib/csu/common/alloc_pbuf.c
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)alloc_pbuf.c 1.1 94/10/31 SMI";
|
||||
#endif
|
||||
/*
|
||||
* Copyright (c) 1987 Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
/* allocate the buffer to be used by profil(2) */
|
||||
char *
|
||||
_alloc_profil_buf(size)
|
||||
int size;
|
||||
{
|
||||
char *buf;
|
||||
int fd;
|
||||
|
||||
if((fd = open("/dev/zero",O_RDONLY)) == -1 ) {
|
||||
return (char*) -1;
|
||||
}
|
||||
buf = (char*) mmap(0, size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
|
||||
close(fd);
|
||||
return buf;
|
||||
}
|
||||
Reference in New Issue
Block a user