Bug 32296

Summary: brk() has illegal prototype
Product: Base System Reporter: Joerg Schilling <schilling>
Component: miscAssignee: dwmalone
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 5.0-CURRENT   
Hardware: Any   
OS: Any   

Description Joerg Schilling 2001-11-26 16:50:01 UTC

Fix: 

brk() always have been returning int and is supposed tto return int by the
standard http://www.opengroup.org/onlinepubs/7908799/xsh/brk.html

FreeBSD returns char * instead....
Comment 1 dwmalone 2001-11-26 17:51:14 UTC
On Mon, Nov 26, 2001 at 05:40:08PM +0100, Joerg Schilling wrote:
> brk() always have been returning int and is supposed tto return int by the
> standard http://www.opengroup.org/onlinepubs/7908799/xsh/brk.html
> 
> FreeBSD returns char * instead....

brk seems to have been returning a char * on BSD for at least the
last 10 years. It makes more sense for it to return an int, but
that could cause binary compatability problems for platforms where
an int and a char * are not the same size (eg. the alpha).

What problems are you seeing with the current implimentation? The
only problem I can think of is that it will cause compiler warnings
if you do:

	if (brk(ptr) == -1)

or if you try to redeclare brk.

	David.
Comment 2 dwmalone freebsd_committer freebsd_triage 2001-11-26 20:03:13 UTC
Responsible Changed
From-To: freebsd-bugs->dwmalone

I'll worry about if we can change brk's prototype or not.
Comment 3 Bruce Evans 2001-11-28 09:04:27 UTC
On Mon, 26 Nov 2001, David Malone wrote:

>  On Mon, Nov 26, 2001 at 05:40:08PM +0100, Joerg Schilling wrote:
>  > brk() always have been returning int and is supposed tto return int by the
>  > standard http://www.opengroup.org/onlinepubs/7908799/xsh/brk.html
>  >
>  > FreeBSD returns char * instead....
>
>  brk seems to have been returning a char * on BSD for at least the
>  last 10 years. It makes more sense for it to return an int, but

Probably for the last 20+ years.  It returned char * in V7 according to
my manuals.

Bruce
Comment 4 dwmalone freebsd_committer freebsd_triage 2002-03-04 12:01:32 UTC
State Changed
From-To: open->closed

Prototypes have now been changed in -current and -stable.