473,386 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

linux kernel c code

i encounter regularly in the linux source code signatures like this:

static void __init do_initcalls(void)
{
definition(whatever)
}

"__init" en "do_initcalls" are two different words. how must one interpret
this? i don't understand a function definition with two separate words.
anybody can explain me this?

Nov 14 '05 #1
11 1932
slurper <sl*********@skynet.be> wrote:
i encounter regularly in the linux source code signatures like this: static void __init do_initcalls(void)
{
definition(whatever)
} "__init" en "do_initcalls" are two different words. how must one interpret
this? i don't understand a function definition with two separate words.
anybody can explain me this?


You shouldn't expect things like kernels to be clean, standard
conforming C - lots and lots of non-portable, compiler-dependend
extensions are typically used. A place where this kind of questions
is on-topic is e.g. comp.os.linux.development.system, here in clc
they are heavily frowned upon since they are compiler- and platform
dependend. In "clean" C the only possibility I can see at the moment
to make that __init stuff at least halfway legal would be by having
a define somewhere before like

#define __init

i.e. by making it invisible or with

#define __init *

(but in this case you would also have to change the function to make
it return a void pointer;-)

<OT>
To satisfy you're curiosity have a look at the init.h header file
in the kernel sources - you will find that __init is defined as
some gcc-supplied extension, a function attribute, which gives
the compiler some additional hints on how the function is going
to be used - nothing you can do in standard C.
</OT>
Regards, Jens
--
\ Jens Thoms Toerring ___ Je***********@physik.fu-berlin.de
\__________________________ http://www.toerring.de
Nov 14 '05 #2
slurper wrote:

i encounter regularly in the linux source code signatures like this:

static void __init do_initcalls(void)
{
definition(whatever)
}

"__init" en "do_initcalls" are two different words. how must one interpret
this? i don't understand a function definition with two separate words.
anybody can explain me this?


This newsgroups is really about ISO standard C and the above is not ISO
standard C.

However, __init is explained a little about 3/4 of the way doen this
page (found by searching google):

http://www.faqs.org/docs/kernel_2_4/lki-1.html

Erik
--
+-----------------------------------------------------------+
Erik de Castro Lopo no****@mega-nerd.com (Yes it's valid)
+-----------------------------------------------------------+
"It's not that perl programmers are idiots, it's that the
language rewards idiotic behavior in a way that no other
language or tool has ever done." -- Erik Naggum
Nov 14 '05 #3
Je***********@physik.fu-berlin.de wrote:
.... snip ...
<OT>
To satisfy you're curiosity have a look at the init.h header file
in the kernel sources - you will find that __init is defined as


While your English is generally excellent, this usage is wrong.
"you're" is an abbreviation for "you are", while "your" is the
possessive. If you don't want to hear it, my apologies and I will
try to remember not to do it again.

--
Chuck F (cb********@yahoo.com) (cb********@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!
Nov 14 '05 #4
<posted & mailed>

slurper wrote:
i encounter regularly in the linux source code signatures like this:

static void __init do_initcalls(void)
{
definition(whatever)
}

"__init" en "do_initcalls" are two different words. how must one interpret
this? i don't understand a function definition with two separate words.
anybody can explain me this?


Not that it has naything to do with Linux, but __init must either be
something compiler specific, or a macro. The declaration above is not using
two words as a function name, the first world is a qualifier just like
'static' and 'void' are. In this particular case, it's a macro that does
something compiler-specific.

--
remove .nospam from e-mail address to reply
Nov 14 '05 #5
CBFalconer <cb********@yahoo.com> scribbled the following:
Je***********@physik.fu-berlin.de wrote:
... snip ...

<OT>
To satisfy you're curiosity have a look at the init.h header file
in the kernel sources - you will find that __init is defined as
While your English is generally excellent, this usage is wrong.
"you're" is an abbreviation for "you are", while "your" is the
possessive. If you don't want to hear it, my apologies and I will
try to remember not to do it again.


Seeing as countless native English speakers get it wrong too, Jens
Toerring can be excused for mixing up those words.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"No, Maggie, not Aztec, Olmec! Ol-mec!"
- Lisa Simpson
Nov 14 '05 #6
Joona I Palaste <pa*****@cc.helsinki.fi> wrote:
CBFalconer <cb********@yahoo.com> scribbled the following:
Je***********@physik.fu-berlin.de wrote:
... snip ...

<OT>
To satisfy you're curiosity have a look at the init.h header file
in the kernel sources - you will find that __init is defined as
While your English is generally excellent, this usage is wrong.
"you're" is an abbreviation for "you are", while "your" is the
possessive. If you don't want to hear it, my apologies and I will
try to remember not to do it again.
Seeing as countless native English speakers get it wrong too, Jens
Toerring can be excused for mixing up those words.


Well, it's nice that CBFalconer tried to help me with that (in
principle I know about the difference, but it still happens
again and again that for some reasons I don't understand I get
them mixed up). Better getting such a thing expained once than
repeating the same stupid mistake over and over again;-)

Regards, Jens
--
\ Jens Thoms Toerring ___ Je***********@physik.fu-berlin.de
\__________________________ http://www.toerring.de
Nov 14 '05 #7
Je***********@physik.fu-berlin.de scribbled the following:
Joona I Palaste <pa*****@cc.helsinki.fi> wrote:
CBFalconer <cb********@yahoo.com> scribbled the following:
Je***********@physik.fu-berlin.de wrote:
... snip ...

<OT>
To satisfy you're curiosity have a look at the init.h header file
in the kernel sources - you will find that __init is defined as While your English is generally excellent, this usage is wrong.
"you're" is an abbreviation for "you are", while "your" is the
possessive. If you don't want to hear it, my apologies and I will
try to remember not to do it again.
Seeing as countless native English speakers get it wrong too, Jens
Toerring can be excused for mixing up those words.
Well, it's nice that CBFalconer tried to help me with that (in
principle I know about the difference, but it still happens
again and again that for some reasons I don't understand I get
them mixed up). Better getting such a thing expained once than
repeating the same stupid mistake over and over again;-)


I'm lucky my native language has a nearly 1-1 correspondence between
writing and pronunciation. One of the best such ones in Europe, in fact.
Thus my knowledge of English spelling is nearly perfect. The downside is
that I don't speak English aloud too well - I have a horrible Finnish
accent.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"And according to Occam's Toothbrush, we only need to optimise the most frequent
instructions."
- Teemu Kerola
Nov 14 '05 #8
Joona I Palaste wrote on 07/08/04 :
CBFalconer <cb********@yahoo.com> scribbled the following:
Je***********@physik.fu-berlin.de wrote:
... snip ...

<OT>
To satisfy you're curiosity have a look at the init.h header file
in the kernel sources - you will find that __init is defined as

While your English is generally excellent, this usage is wrong.
"you're" is an abbreviation for "you are", while "your" is the
possessive. If you don't want to hear it, my apologies and I will
try to remember not to do it again.


Seeing as countless native English speakers get it wrong too, Jens
Toerring can be excused for mixing up those words.


But it's good to know, anyway...

--
Emmanuel
The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html

"C is a sharp tool"

Nov 14 '05 #9
Joona I Palaste wrote:
CBFalconer <cb********@yahoo.com> scribbled the following:
Je***********@physik.fu-berlin.de wrote:
... snip ...

<OT>
To satisfy you're curiosity have a look at the init.h header file
in the kernel sources - you will find that __init is defined as

While your English is generally excellent, this usage is wrong.
"you're" is an abbreviation for "you are", while "your" is the
possessive. If you don't want to hear it, my apologies and I will
try to remember not to do it again.


Seeing as countless native English speakers get it wrong too, Jens
Toerring can be excused for mixing up those words.


Agreed. By and large non-native English speakers write better
English than natives - after all, they have been taught. Joseph
Conrad is a fine example in the literary world. Europeans have
the advantage that they need to speak more than one language,
while USanians don't.

--
Chuck F (cb********@yahoo.com) (cb********@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!
Nov 14 '05 #10
Joona I Palaste wrote:
.... snip ...
I'm lucky my native language has a nearly 1-1 correspondence
between writing and pronunciation. One of the best such ones in
Europe, in fact. Thus my knowledge of English spelling is nearly
perfect. The downside is that I don't speak English aloud too
well - I have a horrible Finnish accent.


Hmm. I haven't noticed it. :-)

--
Chuck F (cb********@yahoo.com) (cb********@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!
Nov 14 '05 #11
On 7 Aug 2004 19:27:36 GMT, Je***********@physik.fu-berlin.de wrote:
Joona I Palaste <pa*****@cc.helsinki.fi> wrote:
CBFalconer <cb********@yahoo.com> scribbled the following: <minor English correction: your versus you're> Seeing as countless native English speakers get it wrong too, Jens
Toerring can be excused for mixing up those words.
Well, it's nice that CBFalconer tried to help me with that (in
principle I know about the difference, but it still happens
again and again that for some reasons I don't understand I get


Possibly the reason I have seen quite a few native speakers -- well,
here native writers -- have trouble: the possessive of a specific
thing uses apostrophe ess: Fred's house; the machine's capacity, etc.
But those of pronouns do not: your; its; his; her; our; their. I think
I once long ago learned that there is actually a reason for this --
unlike many things in English which are arbitrary or accidental or
even actually wrong but enshrined by long usage -- but I have
forgotten it and in any case the original reason no longer matters;
<NearlyTopical> once it's "standard" that becomes the reason. </>
them mixed up). Better getting such a thing expained once than
repeating the same stupid mistake over and over again;-)

I'm certain, completely certain, you meant "explained".

But "expained", even though it isn't a word, sounds so perfectly
apropos as well as mellifluous that it really *should* be!
- David.Thompson1 at worldnet.att.net
Nov 14 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: bouchia.nazha | last post by:
Hello I have encountered a problem using tomcat, linux and ssl. My problem seem to be a JVM memory deallocation problem on Linux. This is my configuration: OS: Redhat7.2 Tomcat: 4.0 Jdk:...
34
by: Maboroshi | last post by:
Hello My question has to do with python and linux - I was interested in finding out what it would take to reimplement the Linux Kernel in python basically just taking the source code from linux...
3
by: Steven T. Hatton | last post by:
http://netlab.ru.is/exception/LinuxCXX.shtml We have implemented a complete kernel level run-time support for C++ in the Linux kernel. In particular our run-time support enables the full use of...
3
by: gooch | last post by:
This is not really a general c question but here goes anyway. I am trying to add a system call to a kernel (redhat 2.4.18) for a class I am taking and I have done the following. in...
2
by: Hao Xu | last post by:
Hi everyone! I think that everyone knows ctime() in glibc: The ctime(), gmtime() and localtime() functions all take an argument of data type time_t which represents calendar time. When ...
4
by: rahul8143 | last post by:
hello, I have some inline declaration questions. 1)why new kernel 2.4.30 has intermediate function of __ instead of direct calling it? int ip_finish_output(struct sk_buff *skb) { return...
27
by: Mike | last post by:
Open source programs in general suck pretty bad also. Here are some loose facts regarding why projects like Linux, PHP, MYSQL, and other open source programs suck: - Linux is simply a clone of...
31
by: arun | last post by:
I know it is a free compiler. But does it follow any standard? If so which standard is it? (Ansi, Ecma, etc?)
8
by: anchitgood | last post by:
Hey, I have developed a project on C++, but under windows. But we have got to run it in an open source (LINUX). Can anyone tell me what features of C++ are not supported in Linux ? Like i have...
16
by: Blubaugh, David A. | last post by:
To All, I was wondering if anyone has come across the issue of not being allowed to have the following within a Python script operating under Linux: time.sleep(0.0125) It appears that I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.