Linux-Development-Sys Digest #57, Volume #7 Mon, 16 Aug 99 16:14:09 EDT
Contents:
Re: RH 6.0 modprobe for lo (Johan Kullstam)
Re: What does ~current->blocked mean? (Robin Smith)
Re: why not C++? (Doug DeJulio)
Re: buffer and page caches (Arun Sharma)
Re: Re : mmap corrupting system -- help! (Grant Edwards)
Re: reading kernel symbols (Robin Becker)
Angekommen? ("Michael Fuchs")
Re: Deadly optimization bug (all versions!) (Kaz Kylheku)
Re: why not C++? (William Burrow)
Re: fork() question (Kaz Kylheku)
Re: What does ~current->blocked mean? (Kaz Kylheku)
Re: reg support of FAT32 on linux kernel 2.2.5-15 (Robin Becker)
Re: why not C++? (Johan Kullstam)
Problems installing Interrupt handler (Joachim Blum)
Re: What is loff_t? (Mark Hamstra)
Re: why not C++? (Kaz Kylheku)
----------------------------------------------------------------------------
From: Johan Kullstam <[EMAIL PROTECTED]>
Subject: Re: RH 6.0 modprobe for lo
Date: 16 Aug 1999 09:21:49 -0400
Robin Becker <[EMAIL PROTECTED]> writes:
> In article <[EMAIL PROTECTED]>, Robin Becker
> <[EMAIL PROTECTED]> writes
> >In article <[EMAIL PROTECTED]>, Johan Kullstam
> ><[EMAIL PROTECTED]> writes
> >>Robin Becker <[EMAIL PROTECTED]> writes:
> >>
> >>> I'm getting some spurious boot messages about modprobe being unable to
> >>> find the lo device. I have inserted an 'alias lo off' line in
> >>> /etc/conf.modules and certainly attempts made after the boot to modprobe
> >>> for lo certainly don't cause errors. I have most of the net stuff in
> >>> modules, but can't figure this nonsense out.
> the command which causes these messages is
> linuxconf --hint ipalias lo
> an RH special just to keep us confused.
yes, i know linuxconf deals with ipaliases. how do i turn them off
*completely* (as in what is in redhat initscripts that i can
disable/comment out). i do not have ipalias built into my kernel.
--
johan kullstam
------------------------------
From: Robin Smith <[EMAIL PROTECTED]>
Subject: Re: What does ~current->blocked mean?
Date: 16 Aug 1999 15:39:48 +0100
[EMAIL PROTECTED] writes:
> In an example of a charter device driver i saw this line of code:
> if(current->signal & ~current->blocked) {
> What does the ~ mean?
> What does this line of code do?
> What are current->signal and current->blocked used for?
>
> - David Belius
I have not written C for at least 5 years but I think ~ is bitwise
complement i.e. 1 become 0 and 0 becomes 1.
This code seems to doing bit comparison of two ( possibly bytes, you
would have to check the definition of current ) numbers.
E.g.
current->signal = 00010000 ( I assume 1 equals a signal )
current->blocked =11101110 ( I assume 1 equals blocked )
This would resolve to 0001000 & 00010001 and on completion of the
bitwise and becomes 00010000 which is non-zero so the if statement is
true.
The code is checking for any unblocked signals.
Robin
Please correct any of the above as I have not written any for years :-)
------------------------------
From: [EMAIL PROTECTED] (Doug DeJulio)
Crossposted-To: comp.os.linux.development.apps,comp.os.linux.misc
Subject: Re: why not C++?
Date: 16 Aug 1999 10:35:58 -0400
In article <[EMAIL PROTECTED]>,
Cocheese <[EMAIL PROTECTED]> wrote:
> Again I admit it would take a little extra work and put a minor set
>back in the evolution for a month or 2, but if C++ is so much faster,
>easier, and stable- WHY NOT?
Not everyone agrees that C++ is faster, easier, and stable. In
particular, it can be demonstrated that any stability C++ has on Linux
is actually fairly recent (egcs).
> There are many differences Between the two programming languages and
>there are huge advantages to C++.
Again, not everyone agrees that there are huge advantages to C++ when
used as a systems (as opposed to applications) programming language.
--
Doug DeJulio | mailto:[EMAIL PROTECTED]
HKS, Incorporated | http://www.hks.net/~ddj/
------------------------------
From: [EMAIL PROTECTED] (Arun Sharma)
Subject: Re: buffer and page caches
Reply-To: [EMAIL PROTECTED]
Date: Mon, 16 Aug 1999 15:42:52 GMT
On 16 Aug 1999 13:42:19 GMT, Robert John Minerick
<[EMAIL PROTECTED]> wrote:
> Could someone explain the differences between the buffer cache and
> the page cache, or at least point me in the direction of a document
> explaining the differences? Thanks...
Both are data structures caching the disk data.
Buffer cache is indexed by <device, offset>
Page cache is indexed by <vnode, offset>
The meanings of all the terms above are the same as the ones used in
your off the shelf Unix internals book.
In Linux 2.2.0, reads of disk data resulted in it being cached in the
page cache, but writes ended up in the buffer cache, while doing a sync
with the page cache for correctness.
This results in
- Duplication of data in RAM
- Update overhead
However, there has been a major redesign of both in Linux 2.3.x and
Linux should be much closer to a unified buffer cache + page cache
now.
-Arun
------------------------------
From: [EMAIL PROTECTED] (Grant Edwards)
Subject: Re: Re : mmap corrupting system -- help!
Date: Mon, 16 Aug 1999 13:51:28 GMT
In article <7p0u57$jr9$[EMAIL PROTECTED]>,
Gilles Alain Pokam Tientcheu wrote:
>> The third one sort-of works (the userprogram sees the right page of memory),
>> but it's corrupting things (processes are croaking mysteriously,
>> and the memory management system complained about that page when shutting
>> down.)
> Looking at your code i think you may have missed somethink. The nopage
> method like described in Rubini's book should return the physical
> address of the missing page.
That's what I thought too, but the example in Rubini's book returns a
kernel-space virtual address that was returned by get_free_page.
[Could be a mistake in the book, or maybe I mis-read the code.]
The user program in my case does see the correct page -- the driver
stores some signiture data in the page when it is allocated, and it's
there when the user program reads the memory.
> The "address" argument in your function scratch_mmap_nopage() is the
> virtual address of the missing page. I think what you need to do is
> to retrieve the real physical address to which this virtual address
> is mapped. What your doing instaed is to allocate a new physical
> page in memory that doesn't necessary corresponds to the desired
> page. If you use a DMA buffer that has been allocated with
> _get_free_pages or similar to hold your data in kernel space, you
> should then increment the usage count of each page in your nopage
> method.
Thanks. I'll try incrementing the page usage and then returning the
physical address instead of the virtual address.
--
Grant Edwards grante Yow! Is this going to
at involve RAW human ecstasy?
visi.com
------------------------------
From: Robin Becker <[EMAIL PROTECTED]>
Subject: Re: reading kernel symbols
Date: Mon, 16 Aug 1999 15:48:17 +0100
In article <[EMAIL PROTECTED]>, Andi Kleen <[EMAIL PROTECTED]>
writes
>Robin Becker <[EMAIL PROTECTED]> writes:
>
>> In article <[EMAIL PROTECTED]>, Kaz Kylheku
>> <[EMAIL PROTECTED]> writes
>> >On Sat, 14 Aug 1999 17:11:04 +0100, Robin Becker <[EMAIL PROTECTED]>
>> >wrote:
>> >>Can any one explain how RH 6.0 + lilo manages to read it's kernel
>> >>symbols from the boot volume /boot at a time before /boot is mounted?
>> >>The read takes place as klogd starts up.
>> >
>> >The kernel knows its own symbols. See /proc/ksyms
>> so what is all the stuff about Loaded xxxx symbols from
>> /boot/System.map-vvvv which appears in my boot messages. Don't these
>> come from klogd?
>
>The read occurs when klogd starts up, long after / (and with it /boot) are
>mounted. klogd just logs all older messages in the kernel message ring
>buffer by then, with the then-current timestamp, because the kernel messages
>don't have an own timestamp.
>This is probably the source of your confusion.
>
>-Andi
>
I'm probably more confused now. The sys/klogd messages appear to be
before the mount. I suppose that's because klogd doesn't preserve the
order of events and stuffs it's own message out apparently first.
Therefore I can assume that properly hacking any links in /boot would
work. RH has a separate /boot volume for some reason I can't quite
fathom which is mounted as you say long after it's needed for modprobe
links etc.
--
Robin Becker
------------------------------
From: "Michael Fuchs" <[EMAIL PROTECTED]>
Subject: Angekommen?
Date: Mon, 16 Aug 1999 17:18:37 +0200
Hi - Nachricht angekommen?
------------------------------
From: [EMAIL PROTECTED] (Kaz Kylheku)
Crossposted-To: gnu.gcc.help
Subject: Re: Deadly optimization bug (all versions!)
Date: Mon, 16 Aug 1999 18:40:55 GMT
On 16 Aug 1999 11:24:11 GMT, Veksler Michael <[EMAIL PROTECTED]> wrote:
>
>---------- bug.c --------
>
>#include <stdio.h>
>
>/* If one=1, then the output should be: bit&1 */
>unsigned test(unsigned one , unsigned bit)
>{
> unsigned val= bit & 1;
> unsigned zero= one >> 1;
>
> val++;
> return zero + ( val>> 1 );
>}
Looks like the compiler is not taking into account the incrementing
of val and is optimizing (val >> 1) to zero, based on it having
been the result of an ``& 1'' operation.
I tried adding an optimization barrier after the increment and it
produced the correct results
val++;
__asm__ __volatile__ ("": : :"memory");
------------------------------
From: [EMAIL PROTECTED] (William Burrow)
Crossposted-To: comp.os.linux.development.apps,comp.os.linux.misc
Subject: Re: why not C++?
Date: 16 Aug 1999 18:16:56 GMT
Reply-To: [EMAIL PROTECTED]
On Mon, 16 Aug 1999 13:38:25 GMT,
Christopher B. Browne <[EMAIL PROTECTED]> wrote:
>>I also noticed in this thread posits like "because g++ is not up to the
>>task" etc, etc. But I am sure that the developers of the Linux kernel
>>uncovered more then 1 bug in gcc!
>
>GCC has represented a stable C compiler for many years now, and may
>be considered mature.
True, but for sure bugs were found in gcc -- look for comments in the
kernel source about these! There are also source optimizations to get
around limitations in the gcc optimizer. There are few comments in
Linux kernel source, but some of them are mighty interesting. :)
>If you want to have an OS written in C++, then it makes sense to start
>designing a C++-based OS kernel.
There are kernels designed in C++ no doubt. I think the Tune OS page
has a listing of various kernels. Memory fades....
>It would make more sense to me to design such in something a bit less
>egregariously complex, perhaps in Modula 3. This would have the clear
>merit that people wouldn't make the Bad Mistake of assuming that they
>could just fiddle with the C code and turn it into M3 as seems to be
>the case with attempts to misdirect Linux kernel development to C++.
Could we start with a C library done in a Wirthian language? Ack, the
horror.... :)
--
William Burrow -- New Brunswick, Canada o
Copyright 1999 William Burrow ~ /\
~ ()>()
------------------------------
From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: fork() question
Date: Mon, 16 Aug 1999 18:54:38 GMT
On Mon, 16 Aug 1999 14:29:11 +0200, Rob <[EMAIL PROTECTED]> wrote:
>Hi, When I do a fork() like this code :
>
>pid = fork()
>
>if (pid==0) // Child process
>{
> some_routine(intparam, charptr);
> exit(0);
>}
>
>// rest of parent process...
>
>and the parent does a waitpid(...) to make sure the child doesn't
>become a zombie.
>Now, my question is, what exactly is copied from the parent to the
>child process? I know file handles are copied to the child, but are
>all global/local variables copied as well ? And what about pointers
They are all copied. What is not copied are the results of the register
which holds the return value from the fork system call. (EAX on Intel
systems).
>pointing to allocated memory prior to the fork process, can a child
>access this memory as well ?
It can access its own copy of the data, not shared with the parent. The
pointer values are the same, but the pointers are evaluated in the context of
the child which has its own address space.
------------------------------
From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: What does ~current->blocked mean?
Date: Mon, 16 Aug 1999 19:00:44 GMT
On Mon, 16 Aug 1999 13:58:47 GMT, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>In an example of a charter device driver i saw this line of code:
>if(current->signal & ~current->blocked) {
>What does the ~ mean?
Check your C reference manual. This is the bitwise negation operator,
which yields the value of its operand with the bits toggled.
The current->blocked gives you a bitmask of what signals are blocked
by the current process. Inverting this bitmask gives you a mask in
which there are zero bits corresponding to the blocked signals.
Then ANDing this mask against current->signal tells you which of
the signals that are *not* blocked are pending, since current->signal
is the mask of pending signals. Each bit in the mask corresponds to
a distinct signal type like SIGINT, SIGTERM, etc.
System calls typically do this test after waking up from an interruptible
sleep. If an unblocked signal was delivered to the process, they then return
the -EINTR result to indicate that the system call was interrupted by the
arrival of a signal.
Note that In the 2.1+ kernels, uses of the expression
(current->signal & ~current->blocked) are replaced by the more intuitive
function/macro signal_pending().
------------------------------
From: Robin Becker <[EMAIL PROTECTED]>
Crossposted-To: redhat.config,redhat.kernel.general
Subject: Re: reg support of FAT32 on linux kernel 2.2.5-15
Date: Mon, 16 Aug 1999 16:06:20 +0100
In article <[EMAIL PROTECTED]>, sarfaraz kazi
<[EMAIL PROTECTED]> writes
>i have win 98 and linux 6.0 with kernel 2.2.5-15 but the kernel does not
>supports fat32 and my win 98 runs on fat32 can anybody guide me what to do
>to fix it?
>sarfaraz
>
>------------------ Posted via CNET Linux Help ------------------
> http://www.searchlinux.com
You'll have to build your own kernel and add in the right things. I'm
Surprised you don't see the Fat32 stuff though. I have an RH 6.0 thing
and it came with vfat support built in. Maybe you don't have the right
mount setup. You can use linuxconf to set it up.
--
Robin Becker
------------------------------
From: Johan Kullstam <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps,comp.os.linux.misc
Subject: Re: why not C++?
Date: 16 Aug 1999 09:32:15 -0400
Cocheese <[EMAIL PROTECTED]> writes:
> Dear Linux Community;
>
> There has been a puzzling question on my mind for some time. First, I
> admit i am no Linux Guru so this may be off the wall.
>
>
> *Why Is linux done primarily in the C programming language rather than
> C++?*
oh dear god no. not *this* thread again.
<URL:http://deja.com/>
browse to your hearts content.
> Again I admit it would take a little extra work and put a minor set
> back in the evolution for a month or 2, but if C++ is so much faster,
> easier, and stable- WHY NOT?
well, it's not. at least if you are comparing C++ to C. C++ is equal
at best. C++ has a library which is constantly being revised. (i've
now got *5*, count 'em, *5* incompatible versions of libstc++.so on my
system.) C has libc which also changes, but it changes much more
slowly.
for kernel work, this library is not really an issue, since *you don't
have a library* and that make C++ somewhat less of a win.
> I have been a RH 6.0 user since the first week it was first released
> and since then i have loved it. I am struggling with it a bit but as i
> continue to learn this from an "other leading brand OS" and a full time
> programmer for a large company.
>
> There are many differences Between the two programming languages and
> there are huge advantages to C++.
this is a matter of opinion. it also depends heavily on your target
program. applications in C++ is a good idea. for kernel and vital
utilities, i would say C++ is a bad idea.
> The downside is "linux has always been a C based Program so it will always
> be."
hey UTSL. get back to us when you've got something.
> *** BUT THEN AGAIN - ISN'T LINUX ALL ABOUT CHANGE? ***
no. it's not. it's about cloning a 30 year old operating system.
admittedly it's a fairly good operating system. deviations are still
frowned upon.
--
johan kullstam
------------------------------
From: Joachim Blum <[EMAIL PROTECTED]>
Subject: Problems installing Interrupt handler
Date: Mon, 16 Aug 1999 18:31:08 +0200
Hi,
I have some problems installing an interrupt handler for a new device.
I gues I missed something in the documentation, but I really can't see
it.
Maybe somebody can help me. Thanks in advance.
In my device driver, which was able to poll the device I wanted to
insert the
interrupt handler. So I did the following steps:
1) I wrote the following function:
static void psm_intr(int irq, void *dev_id, struct pt_regs *regs)
{
/* printk("PSM: INTERRUPT !!\n");*/
return;
}
2) I inserted the following statement in the function init_module()
if (request_irq(psm_local.irq, psm_intr, 0, "psm", NULL)) {
printk("PSM: Can't allocate IRQ %d for device\n",psm_local.irq);
return -EIO;
}
This seems to work since the /proc/interrupts show now that IRQ 10 is
handled
by my device "PSM"
But as soon as the device initiates an interrupt the system hangs.
When I'm removing the lines in init_module() and initiate the interrupt
the there just no effect (so I guess the device itself is OK).
What did I miss in the docu?
I even tried to patch the kernel in the ../irq.c to printk as soon as
IRQ10 is called and
do no further action. But this didn't work? How does the interrupt
handling work?
I read "The Linux Kernel" by David Rusling, but I didn't get the glue.
Is there
a better reference for doing device driver development?
Thanks for answer.
--Joe
------------------------------
From: Mark Hamstra <[EMAIL PROTECTED]>
Subject: Re: What is loff_t?
Date: 16 Aug 1999 14:18:37 -0400
[EMAIL PROTECTED] writes:
> What is the type loff_t used for?
64bit version of off_t.
> What is it used for in the arg to a charter device's read function?
> The prototype for such a function is:
> ssize_t foo_read(struct file *, char *, size_t, loff_t *);
> What is the ssize_t type used for?
The return value of foo_read() ;-) Seriously though, I'd have to
grep through /usr/include to figure ssize_t out, but I'll guess
that it's a long version of size_t, similar to how loff_t is a
long version of off_t.
--
Mark Hamstra
Bentley Systems, Inc.
------------------------------
From: [EMAIL PROTECTED] (Kaz Kylheku)
Crossposted-To: comp.os.linux.development.apps,comp.os.linux.misc
Subject: Re: why not C++?
Date: Mon, 16 Aug 1999 19:42:54 GMT
On 16 Aug 1999 18:16:56 GMT, William Burrow <[EMAIL PROTECTED]> wrote:
>There are kernels designed in C++ no doubt. I think the Tune OS page
>has a listing of various kernels. Memory fades....
But how do these stack up in static web page serving benchmarks? :) :) :)
------------------------------
** FOR YOUR REFERENCE **
The service address, to which questions about the list itself and requests
to be added to or deleted from it should be directed, is:
Internet: [EMAIL PROTECTED]
You can send mail to the entire list (and comp.os.linux.development.system) via:
Internet: [EMAIL PROTECTED]
Linux may be obtained via one of these FTP sites:
ftp.funet.fi pub/Linux
tsx-11.mit.edu pub/linux
sunsite.unc.edu pub/Linux
End of Linux-Development-System Digest
******************************