tech-misc archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: __attribute__((warn_unused_result)) for NetBSD?



 >>> In general EBADF is meaningless on close.
 >> Yes, EBADF is not a big problem.
 >>
 >>> Isn't it only possible to get EINTR on non-blocking I/O? Otherwise
 >>> isn't this an auto-restarted call?
 >> AFAIK SA_RESTART is BSD-ism and is absent on many systems.
 >>

> We're kinda discussing a BSD system so it's kinda relevant. I don't
> really care if linux didn't implement it...

joke: Windows is a product, UNIX is a specification.

I prefer to write software that works on all variants of UNIX
including NetBSD, Linux and even platforms I'm not aware of.

FYI: Linux supports SA_RESTART as well as Solaris and HP-UX 11i.

 >>> Anyways, for the most part all common usages of close don't need
 >>> warnings about missing the return value that I can see.
 >> I personally disagree. The following is much more robust approach.
 >>
 >> void xclose (int fd)
...
> You may choose to write such code. The reality is (especially for
> close) that code like this doesn't exist and likely has no value on
> systems with restartable system calls.
Some portions of NetBSD code is used under varianty of platforms
as a part of pkgsrc. I also use some other NetBSD tools under Linux
and Interix. Ideally NetBSD code should run smoothly on other UNIX-like OSes.
Are you against it?

Portability is one of the main reason why UNIX (as a concept) is alife
for more than 37 years.

-- 
Best regards, Aleksey Cheusov.


Home | Main Index | Thread Index | Old Index