Date: Fri, 16 Jul 1999 12:04:08 -0400 From: Garance A Drosihn <drosih@rpi.edu> To: Matthew Dillon <dillon@apollo.backplane.com>, "Brian F. Feldman" <green@FreeBSD.ORG> Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Swap overcommit Message-ID: <v04011700b3b504f281a2@[128.113.24.47]> In-Reply-To: <199907160452.VAA15530@apollo.backplane.com> References: <Pine.BSF.4.10.9907152343060.47920-100000@janus.syracuse.net>
next in thread | previous in thread | raw e-mail | index | archive | help
At 9:52 PM -0700 7/15/99, Matthew Dillon wrote: >:> ... How many programmers bother to even *clear* errno before >:> making these calls (since some system calls do not set errno >: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >:> if it already non-zero). Virtually nobody. >: ^^^^^^^^^^^^^^^^^^^^^^^ >: >:Erm... WTF?!?! If so, why the HELL are we doing that?!? > > No, wait, I got that wrong I think. > > Oh yah, I remember now. Hmm. How odd. I came across a case > where read() could return -1 and not set errno properly if > errno was already set, but a perusal of the kernel code seems > to indicate that this can't happen. Very weird. For what it's worth, I know I've run into situations where errno had to be cleared before calling some system routine (but I don't think it was read, and I am sure it wasn't on freebsd). As I remember it, it was some case where "sysrtn1" called another system routine (and you would be calling "sysrtn1"). If the call to the inner system routine failed, then the inner routine would set errno and "sysrtn" would return it's own error. However, "sysrtn1" would return the SAME error in some other circumstances, circumstances which did not set errno. So, if you wanted to check errno when you got an error return from "sysrtn1", you had to be sure to zero it out before calling "sysrtn1". This was a lesson taught after a long wild-goose chase trying to track down the wrong reason for an error-return from "sysrtn1" (whatever that routine was...), because we had NOT zeroed out errno first. --- Garance Alistair Drosehn = gad@eclipse.acs.rpi.edu Senior Systems Programmer or drosih@rpi.edu Rensselaer Polytechnic Institute 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?v04011700b3b504f281a2>