From owner-freebsd-hackers Fri Mar 24 00:54:16 1995 Return-Path: hackers-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id AAA22790 for hackers-outgoing; Fri, 24 Mar 1995 00:54:16 -0800 Received: from p5.spnet.com (elh.com [204.156.130.1]) by freefall.cdrom.com (8.6.10/8.6.6) with ESMTP id AAA22782 for ; Fri, 24 Mar 1995 00:54:13 -0800 Received: from localhost.spnet.com (localhost.spnet.com [127.0.0.1]) by p5.spnet.com (8.6.11/8.6.6) with SMTP id AAA15572; Fri, 24 Mar 1995 00:52:12 GMT Message-Id: <199503240052.AAA15572@p5.spnet.com> X-Authentication-Warning: p5.spnet.com: Host localhost.spnet.com didn't use HELO protocol To: hackers@FreeBSD.org cc: elh@p5.spnet.com Subject: is this reasonable? Date: Fri, 24 Mar 1995 00:52:11 +0000 From: Ed Hudson Sender: hackers-owner@FreeBSD.org Precedence: bulk sbrk called with an arg of 1 (eg, sbrk(1)) under fbsd2.x increments the brk by 1. under SunOS4.1.3, sbrk(1) increments the brk by 8, and returns a result always double-word (8byte) aligned. fbsd malloc, /usr/lib/src/libc/stdlib/malloc.c, only aligns sbrk on its first call. i'm hazy about whether or not fbsd requires malloc to have exclusive control of a programs brk values, but in my reading of the man pages and this code, it doesn't appear to be the case. if indeed malloc is supposed to be able to co-exist with other routines calling sbrk with >0 values, then i think that either malloc has a latent bug, or sbrk is broken in its behavior. clearly confused and seeking re-education... -elh #include #include #include int main(int argc, char **argv) { char *t; int i; for (i=0; i<8; i++) { fprintf(stderr,"sbrk(1)= 0x%08x\n",sbrk(1)); } return(0); } FreeBSD output FreeBSD p5 2.1.0-Development FreeBSD 2.1.0-Development #0: Mon Mar 20 17:43:36 1995 gcc version 2.6.3 sbrk(1)= 0x00002204 sbrk(1)= 0x00002205 sbrk(1)= 0x00002206 sbrk(1)= 0x00002207 sbrk(1)= 0x00002208 sbrk(1)= 0x00002209 sbrk(1)= 0x0000220a sbrk(1)= 0x0000220b sun4 (gcc), sunos4.1.3 output: SunOS maui 4.1.3 1 sun4c gcc version 2.6.0 sbrk(1)= 0x00007368 sbrk(1)= 0x00007370 sbrk(1)= 0x00007378 sbrk(1)= 0x00007380 sbrk(1)= 0x00007388 sbrk(1)= 0x00007390 sbrk(1)= 0x00007398 sbrk(1)= 0x000073a0