Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Oct 1998 15:11:03 -0500
From:      Glenn Johnson <gjohnson@commserver.srrc.usda.gov>
To:        freebsd-hackers@FreeBSD.ORG
Subject:   reconciling different defines in header files between Linux and  FreeBSD
Message-ID:  <199810232011.PAA00764@symbion.srrc.usda.gov>

next in thread | raw e-mail | index | archive | help
Greetings,

I am trying to compile code on FreeBSD 3.0 that was written with Linux in 
mind.
The following code snippet is where it is failing:

  void galloc_ (nwords, wordsize, iclear, refarray, offset)
    f77_int *nwords, *wordsize, *iclear;
    offset_type *offset;
    f77_wp *refarray;
    {
    f77_wp *gmalloc();
    size_t nbytes;
    offset_type n;
  #ifdef DO_SHM
    int shmflags = 0;
    void *brkadr, *sbrk();
    key_t shmkey;

The error that I get is:

bsd/mdutil.c: In function `galloc_':
bsd/mdutil.c:2630: conflicting types for `sbrk'
/usr/include/unistd.h:168: previous declaration of `sbrk'
bsd/mdutil.c:2630: warning: extern declaration of `sbrk' doesn't match 
global one

sbrk is defined in <unistd.h> in FreeBSD as:

  char    *sbrk __P((int));

sbrk is defined in <unistd.h> in Linux as:

  extern __ptr_t __sbrk __P ((ptrdiff_t __delta));
  extern __ptr_t sbrk __P ((ptrdiff_t __delta));

What is the right way to reconcile my code? Do I need to redefine sbrk in the source file as extern or do I make the call explicitly char?

Thanks in advance.
-- 
Glenn Johnson
Technician
USDA, ARS, SRRC
New Orleans, LA



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199810232011.PAA00764>