From: Bill Cunningham on

"Patricia Shanahan" <pats(a)acm.org> wrote in message
news:roKdnSMrsp2iHivWnZ2dnUVZ_gmdnZ2d(a)earthlink.com...

> Operating systems I've worked on have their own functions for the tasks
> they need to do internally. Those functions meet the specific needs of
> the kernel, rather than conforming to the POSIX standard. Typically,
> they are written in layers. The lowest layer deals directly with the
> hardware, often requiring at least some processor specific code.
>
> For specific information, read an internals book for a kernel that
> interests you.
>
> Incidentally, kernel programmers are just as human as application
> programmers.

Thank you very much Patricia. I have been under the impression for a
long time that a kernel communicated with user space with sys calls. Like
the posix socket() and bind() read() and so on. I imagined a kernel was
designed to call these same calls the posix api uses. So a kernel has it's
own functions to fork and create PIDs. The linux kernel is a little beyond
me. I'm working on ncurses and posix networking now. The ncurses is pretty
much down as far as the main aspects. But the posix is what I'm after now.
Just thought I'd get clear on the kernel functioning in theory.

Bill


From: Bill Cunningham on

"Pascal J. Bourguignon" <pjb(a)informatimago.com> wrote in message
news:87y6h4kiad.fsf(a)galatea.lan.informatimago.com...

> Why don't you go and see for yourself? You'd learn a lot by reading the
> kernel sources. (It may be something else than /usr/src/linux,
>
> $ find /usr/src/linux/ -name \*.c -exec grep -n fork {} /dev/null \;

[snip]

Wow I've never used find like that before. What's the last backslash for?

Bill


From: Kai-Uwe Bux on
Bill Cunningham wrote:

>
> "Pascal J. Bourguignon" <pjb(a)informatimago.com> wrote in message
> news:87y6h4kiad.fsf(a)galatea.lan.informatimago.com...
>
>> Why don't you go and see for yourself? You'd learn a lot by reading the
>> kernel sources. (It may be something else than /usr/src/linux,
>>
>> $ find /usr/src/linux/ -name \*.c -exec grep -n fork {} /dev/null \;
>
> [snip]
>
> Wow I've never used find like that before. What's the last backslash for?

It escapes the ";" so that it becomes the last character in the argument to
the -exec option for find (find wants that). Otherwise the shell would
interpret the ";".


Best

Kai-Uwe Bux
From: Daniel Pitts on
On 4/3/2010 12:29 PM, Bill Cunningham wrote:
> "Pascal J. Bourguignon"<pjb(a)informatimago.com> wrote in message
> news:87y6h4kiad.fsf(a)galatea.lan.informatimago.com...
>
>> Why don't you go and see for yourself? You'd learn a lot by reading the
>> kernel sources. (It may be something else than /usr/src/linux,
>>
>> $ find /usr/src/linux/ -name \*.c -exec grep -n fork {} /dev/null \;
>
> [snip]
>
> Wow I've never used find like that before. What's the last backslash for?
>
> Bill
>
>
The \ is used by the shell interpreter (rather than the command). The
"find" command is passed in the arguments:
"/usr/src/linux/"
"-name"
"*.c"
"-exec"
"grep"
"-n"
"fork"
"{}"
"/dev/null"
";"

the -exec argument tells "find" to execute the following command (up to
the ;) for every match it finds, substituting the match where it sees a
"{}" argument.


--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
From: Pascal J. Bourguignon on
"Bill Cunningham" <nospam(a)nspam.invalid> writes:

> "Pascal J. Bourguignon" <pjb(a)informatimago.com> wrote in message
> news:87y6h4kiad.fsf(a)galatea.lan.informatimago.com...
>
>> Why don't you go and see for yourself? You'd learn a lot by reading the
>> kernel sources. (It may be something else than /usr/src/linux,
>>
>> $ find /usr/src/linux/ -name \*.c -exec grep -n fork {} /dev/null \;
>
> [snip]
>
> Wow I've never used find like that before. What's the last backslash for?

In addition to the other answers, I'll mention that you could as well
use ';' or ";" instead of \;

A token is needed by find to separate the options to the command called
by -exec from the remaining options for find:

find /tmp -exec printf "--> %s\n" {} ';' -type f -exec printf " is a file\n" \;



--
__Pascal Bourguignon__