Change brk's prototype from char *brk(const char *) to int brk(const void *)
and sbrk's prototype from char *sbrk(int) to void *sbrk(intptr_t). This makes us more consistant with NetBSD and standards which include these functions. Bruce pointed out that ptrdiff_t would probably have been better than intptr_t, but this doesn't match other implimentations. Also remove local declarations of sbrk and unnecessary casting. PR: 32296 Tested by: Harti Brandt <brandt@fokus.gmd.de> MFC after: 1 month
This commit is contained in:
parent
e4e61f7853
commit
98d1592458
@ -118,7 +118,7 @@ struct timeval; /* select(2) */
|
|||||||
#endif
|
#endif
|
||||||
int acct __P((const char *));
|
int acct __P((const char *));
|
||||||
int async_daemon __P((void));
|
int async_daemon __P((void));
|
||||||
char *brk __P((const char *));
|
int brk __P((const void *));
|
||||||
int chroot __P((const char *));
|
int chroot __P((const char *));
|
||||||
size_t confstr __P((int, char *, size_t));
|
size_t confstr __P((int, char *, size_t));
|
||||||
char *crypt __P((const char *, const char *));
|
char *crypt __P((const char *, const char *));
|
||||||
@ -187,7 +187,7 @@ pid_t rfork_thread __P((int, void *, int (*)(void *), void *));
|
|||||||
int rresvport __P((int *));
|
int rresvport __P((int *));
|
||||||
int rresvport_af __P((int *, int));
|
int rresvport_af __P((int *, int));
|
||||||
int ruserok __P((const char *, int, const char *, const char *));
|
int ruserok __P((const char *, int, const char *, const char *));
|
||||||
char *sbrk __P((int));
|
void *sbrk __P((intptr_t));
|
||||||
int select __P((int, fd_set *, fd_set *, fd_set *, struct timeval *));
|
int select __P((int, fd_set *, fd_set *, fd_set *, struct timeval *));
|
||||||
int setdomainname __P((const char *, int));
|
int setdomainname __P((const char *, int));
|
||||||
int setegid __P((gid_t));
|
int setegid __P((gid_t));
|
||||||
|
@ -42,11 +42,12 @@
|
|||||||
.Sh LIBRARY
|
.Sh LIBRARY
|
||||||
.Lb libc
|
.Lb libc
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
|
.In sys/types.h
|
||||||
.In unistd.h
|
.In unistd.h
|
||||||
.Ft char *
|
.Ft int
|
||||||
.Fn brk "const char *addr"
|
.Fn brk "const void *addr"
|
||||||
.Ft char *
|
.Ft void *
|
||||||
.Fn sbrk "int incr"
|
.Fn sbrk "intptr_t incr"
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
.Bf -symbolic
|
.Bf -symbolic
|
||||||
The
|
The
|
||||||
@ -116,22 +117,13 @@ value is returned from a call to
|
|||||||
for the definition of
|
for the definition of
|
||||||
.Va etext ) .
|
.Va etext ) .
|
||||||
.Sh RETURN VALUES
|
.Sh RETURN VALUES
|
||||||
The
|
.Rv -std brk
|
||||||
.Fn brk
|
|
||||||
function returns
|
|
||||||
.Po Vt "char *" Pc Ns 0
|
|
||||||
if successful;
|
|
||||||
otherwise the value
|
|
||||||
.Po Vt "char *" Pc Ns \-1
|
|
||||||
is returned and the global variable
|
|
||||||
.Va errno
|
|
||||||
is set to indicate the error.
|
|
||||||
.Pp
|
.Pp
|
||||||
The
|
The
|
||||||
.Fn sbrk
|
.Fn sbrk
|
||||||
function returns the prior break value if successful;
|
function returns the prior break value if successful;
|
||||||
otherwise the value
|
otherwise the value
|
||||||
.Po Vt "char *" Pc Ns \-1
|
.Po Vt "void *" Pc Ns \-1
|
||||||
is returned and the global variable
|
is returned and the global variable
|
||||||
.Va errno
|
.Va errno
|
||||||
is set to indicate the error.
|
is set to indicate the error.
|
||||||
|
@ -2518,7 +2518,7 @@ malloc(size)
|
|||||||
|
|
||||||
newbrk = (char *)
|
newbrk = (char *)
|
||||||
roundup2((unsigned long)rtld_alloc_lev, PAGSIZ);
|
roundup2((unsigned long)rtld_alloc_lev, PAGSIZ);
|
||||||
if (brk(newbrk) == (char *)-1)
|
if (brk(newbrk) == -1)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +119,6 @@ union overhead {
|
|||||||
*/
|
*/
|
||||||
#define NBUCKETS 30
|
#define NBUCKETS 30
|
||||||
static union overhead *nextf[NBUCKETS];
|
static union overhead *nextf[NBUCKETS];
|
||||||
extern char *sbrk();
|
|
||||||
|
|
||||||
static int pagesz; /* page size */
|
static int pagesz; /* page size */
|
||||||
static int pagebucket; /* page size bucket */
|
static int pagebucket; /* page size bucket */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user