Browse Source

Change sbrk definitions.

The prototypes difference between platform is really annoying, since it's hard to always match the system on, and prevent warning on bad types. I try now to always use BRK emulation on all platform that do not match the prototype used in ACK. the PM script should be changed to set this correctly during setup.
Godzil 11 years ago
parent
commit
06665f4624
2 changed files with 7 additions and 7 deletions
  1. 2 2
      h/missing_proto.h
  2. 5 5
      modules/src/sbrk/sbrk_emu.c

+ 2 - 2
h/missing_proto.h

@@ -3,7 +3,7 @@
 
 
 #ifdef NOSBRK
 #ifdef NOSBRK
 void *sbrk(__intptr_t increment);
 void *sbrk(__intptr_t increment);
-int   brk(void * addr);
+void *brk(void * addr);
 #endif
 #endif
 
 
 #ifdef NOMKTEMP
 #ifdef NOMKTEMP
@@ -12,7 +12,7 @@ char *mktemp(char *template);
 
 
 #ifdef EMULATE_BRK
 #ifdef EMULATE_BRK
 void *sbrk_emu(int increment);
 void *sbrk_emu(int increment);
-int   brk_emu(void * addr);
+void *brk_emu(const void * addr);
 
 
 #ifdef sbrk
 #ifdef sbrk
 #undef sbrk
 #undef sbrk

+ 5 - 5
modules/src/sbrk/sbrk_emu.c

@@ -27,14 +27,14 @@ extern char *calloc();
 static void *bottom = NULL;             /* bottom of calloc()ed pseudo-heap */
 static void *bottom = NULL;             /* bottom of calloc()ed pseudo-heap */
 static void *brkval = NULL;             /* current value of simulated break */
 static void *brkval = NULL;             /* current value of simulated break */
 
 
-int brk_emu( void *endds )
+void *brk_emu(const void *endds )
 {
 {
 	int offset;
 	int offset;
 	if ( bottom == NULL )
 	if ( bottom == NULL )
 	{
 	{
 		if ( (bottom = calloc( HEAP_SIZE, 1 )) == 0 )
 		if ( (bottom = calloc( HEAP_SIZE, 1 )) == 0 )
 		{
 		{
-			return BRK_ERR; /* unable to set up pseudo-heap */
+			return (void *)BRK_ERR; /* unable to set up pseudo-heap */
 		}
 		}
 		else
 		else
 		{
 		{
@@ -45,12 +45,12 @@ int brk_emu( void *endds )
 	if ( (offset = endds - bottom) < 0 || offset > HEAP_SIZE )
 	if ( (offset = endds - bottom) < 0 || offset > HEAP_SIZE )
 	{
 	{
 		errno = ENOMEM;
 		errno = ENOMEM;
-		return BRK_ERR; /* attempt to set break out of heap */
+		return (void *)BRK_ERR; /* attempt to set break out of heap */
 	}
 	}
 	else
 	else
 	{
 	{
-		brkval = endds;
-		return BRK_OK;
+		brkval = (void *)endds;
+		return (void *)BRK_OK;
 	}
 	}
 }
 }