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

Re: where is #define __linux__

On Tue, Jan 09, 2001 at 02:22:45PM +0100, Marcus Brinkmann wrote:
> Just as a side note, think twice (or even thrice) before using that symbols.
> Is the code really linux specific? For example, a Linux kernel feature
> certainly is, but many other things aren't. Often it is more appropriate
> to check for specific POSIX features, or the existance of the GNU C library,
> or something else entirely. autoconf can help here, as well as "liberty"
> (libiberty :) Of course, this depends on the thing you want to implement,
> but choosing the right check makes the software more portable.

Yes, the code is linux and solaris specific. In linux, I'm testing
/proc, and in solaris, I'm placing a syscall(). 

As a different but related side note, AFAIK POSIX doesn't specify a
way to tell if a particular file is open. I'm coding up a simplified
fuser function to help boost system performance on our servers.

> To see a full list of compiler defined symbols, use
> gcc -dM -E - < /dev/null

Woohoo, that's pretty cool.

Thanks for the info. 

Reply to: