[linux-help] Re: Blood and Guts
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Wed, 7 Jun 2000, Lrs v.d.Ast wrote:
> extern ssize_t __write __P ((int __fd, __const __ptr_t __buf, size_t __n));
> extern ssize_t write __P ((int __fd, __const __ptr_t __buf, size_t __n));
>
> I understand extern to allow globally declared stuff to not
> step on each other, hence ssize_t is declared as a global in
> some other file, right?
Nope.
'extern' means the function is defined somewhere else. It tells
the compiler "I'm gonna use this function, but I'm not gonna
define it -- you'll know about it time, trust me".
ssize_t is the return type of the function, and should be defined
by this point in the compilation process, probably by a #define or
#include earlier.
> I'm confused by how ssize_t is followed by a __write (or
> write) but then a space then __P then double parentheses!
> What's going on here?
__write and write are the function names.
__P is a macro, I believe defined in /usr/include/glob.h (maybe
other places) that affect the behavior of the compiler -- whether
you're compiling C++ or C code. The double parens are necessary to
protect the macro definition, and then end up with one set of
parens for the legal function definition.
> I guess __P is the real write function, embedded in the
> __write function?
No, see above.
> Also, what is the convention for this double underscore stuff?
Functions that start with double underscore are typically
library-level functions that you wouldn't normally call directly.
> And finally, where is the code where my
> write() function actually gets done?
Well, my return question would be, "why do you care?" Call
printf and be happy it goes where it's supposed to ..? Where
it really ends up going is a question you can answer very clearly
for yourself by following the code, just as you have been.
> Hopefully somebody knows and maybe somebody can put me on the
> trail of a book, etc. that will explain some of this blood and
> guts stuff.
There's at least a few books out on "linux kernel internals" and
other C programming ones that should help.
-jeff
--
We will have no generalizations. --G.K. Chesterston
-- This is the linux-help@xxxxxxxxx list. To unsubscribe,
visit http://tmp2.complete.org/cgi-bin/listargate-aclug.cgi
- [linux-help] Re: netcfg errors out, (continued)
- [linux-help] Re: netcfg errors out, Greg House, 2000/06/03
- [linux-help] Re: netcfg errors out, Bruce Bales, 2000/06/03
- [linux-help] Re: netcfg errors out, Greg House, 2000/06/03
- [linux-help] Re: netcfg errors out, Bruce Bales, 2000/06/03
- [linux-help] Re: netcfg errors out, Greg House, 2000/06/05
- [linux-help] Re: netcfg errors out, Bruce Bales, 2000/06/06
- [linux-help] Re: netcfg errors out, Greg House, 2000/06/06
- [linux-help] Re: netcfg errors out, Dale W Hodge, 2000/06/07
- [linux-help] Re: netcfg errors out, John Alexander, 2000/06/07
- [linux-help] Blood and Guts, Lrs v.d.Ast, 2000/06/07
- [linux-help] Re: Blood and Guts,
Jeff <=
- [linux-help] Re: Blood and Guts, Tom Hull, 2000/06/07
- [linux-help] Re: netcfg errors out, Dale W Hodge, 2000/06/07
[linux-help] Re: netcfg errors out, Bruce Bales, 2000/06/01
|
|