home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
LIBSRC.ZOO
/
libsrc
/
local
/
sod.c
< prev
next >
Wrap
Text File
|
1992-03-14
|
863b
|
41 lines
#define INCL_DOSMEMMGR
#define INCL_DOSERRORS
#include <os2.h>
#include <sys/types.h>
#include <errno.h>
ULONG Dos32AllocMem() asm ("Dos32AllocMem");
void *__start_of_data = 0;
void *__first_uncommited_block = 0;
void *__first_uncommited_byte = 0;
void * start_of_data ()
{
ULONG rc;
if (__start_of_data)
return (__start_of_data);
rc = Dos32AllocMem (&__start_of_data, 0x4000000, PAG_READ | PAG_WRITE);
if (rc) {
if (rc == ERROR_NOT_ENOUGH_MEMORY) {
errno = ENOMEM;
return ((void *)-1);
}
if (rc == ERROR_INVALID_PARAMETER) {
errno = EINVAL;
return ((void *)-1);
}
errno = -1;
return ((void *)-1);
}
__first_uncommited_block = __first_uncommited_byte = __start_of_data;
return (__start_of_data);
}