do_brk() error return
From: sean larsson (infamous42md_at_ERASEMEhotpop.com)
Date: 07/30/04
- Next message: anand: "PS 2 keyboard device driver"
- Previous message: Lew Pitcher: "Re: How to aviod a process from deleting an opened file"
- Next in thread: David Schwartz: "Re: do_brk() error return"
- Reply: David Schwartz: "Re: do_brk() error return"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 30 Jul 2004 02:49:46 GMT
the do_brk() function returns an unsigned long. usually this value is
the new address of the top of the heap. however, when it encounters an
error, it will return a negative error code, ie -EAGAIN or w/e. so, i'm
wondering: what if the top of the heap address has the high order bit
set? i know that the heap usually starts at a low address on my x86
computers, but i haven't run linux on other platforms so i'm not sure if
that holds true. and also, why would the developers return a negative
value in a function that returns an unsigned long? you'd need to cast
the return to signed type, or test high order bit to check for an error,
which seems like a dumb thing to do imho. comments?
-- -sean
- Next message: anand: "PS 2 keyboard device driver"
- Previous message: Lew Pitcher: "Re: How to aviod a process from deleting an opened file"
- Next in thread: David Schwartz: "Re: do_brk() error return"
- Reply: David Schwartz: "Re: do_brk() error return"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|