Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Apr 1999 19:53:13 -0600
From:      Dan Nelson <dnelson@emsphone.com>
To:        Glenn Johnson <gjohnson@nola.srrc.usda.gov>
Cc:        questions@FreeBSD.ORG
Subject:   Re: errno definitions
Message-ID:  <19990402195313.A71842@dan.emsphone.com>
In-Reply-To: <19990402152609.A54392@symbion.srrc.usda.gov>; from "Glenn Johnson" on Fri Apr  2 15:26:09 GMT 1999
References:  <19990402152609.A54392@symbion.srrc.usda.gov>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Apr 02), Glenn Johnson said:
> I am trying to compile some code (not mine, but it is proprietary)
> that compiles on Linux and Irix, but not on FreeBSD. The problem I am
> running into is that the program makes use of the following
> definitions from errno.h:
> 
>         EMULTIHOP and ENOLINK.
> 
> I looked in a Linux <errno.h> header file and found the following
> definitions:
> 
> #define ENOLINK         67      /* Link has been severed */
> #define EMULTIHOP       72      /* Multihop attempted */
> 
> The numbers in the FreeBSD errno.h file go up to 86. So I was
> thinking I could construct a local header file with these definitions
> using 87 and 88. Or can someone recommend equivalent functions that I
> could replace these definitions with?

Simply wrap the offending code with "#ifdef ENOLINK ... #endif", since
no FreeBSD function will ever return those errors, so you don't have to
write code to handle those error cases.

If you try and add those two definitions, you will end up with
undefined behaviour, since on FreeBSD, errnos 67 and 72 are EPROCLIM
and EBADRPC, and your code could end up doing "link has been severed"
recovery code when FreeBSD has actually returned "too many processes".

	-Dan Nelson	
	dnelson@emsphone.com


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




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