Files
Arquivotheca.Solaris-2.5/lib/libbc/csu/common/alloc_pbuf.c
seta75D 7c4988eac0 Init
2021-10-11 19:38:01 -03:00

24 lines
434 B
C
Executable File

#pragma ident "@(#)alloc_pbuf.c 1.5 92/07/20 SMI"
/*
* 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;
}