Linux-Development-Sys Digest #361, Volume #8 Tue, 19 Dec 00 05:13:11 EST
Contents:
Do "Lions' Commentary on UNIX" good for knowing unix kernal? (Carfield Yim)
Re: Do "Lions' Commentary on UNIX" good for knowing unix kernal? (Joe Humrickhouse)
Re: Can not open a file within a kernel module (Kasper Dupont)
Re: Kernel say: Unable to open initial console (Kasper Dupont)
Re: Open file in module? (Kasper Dupont)
Re: Intel Easy PC camera - cannot be supported in Linux! (Kasper Dupont)
Re: Compiling C++ programs with GCC --> no GPL license implications (Peter Seebach)
Re: Open file in module? (Richard Kolb)
Re: How to ensure a page not being swapped out (Josef Moellers)
Re: how to use raw device ([EMAIL PROTECTED])
Re: Do "Lions' Commentary on UNIX" good for knowing unix kernal? (Josef Moellers)
Re: how to use raw device (Josef Moellers)
Re: Open file in module? (Arne Driescher)
Re: Can not open a file within a kernel module (Arne Driescher)
Re: Compiling C++ programs with GCC --> no GPL license implications (Tor Slettnes)
Re: Compiling C++ programs with GCC --> no GPL license implications ("Jeffrey B.
Siegal")
about __free_pages_ok() (lavender)
IEEE standards (Bart De Schuymer)
Re: How to ensure a page not being swapped out (Eric)
Re: Compiling C++ programs with GCC --> no GPL license implications (Stefaan A
Eeckels)
----------------------------------------------------------------------------
From: Carfield Yim <[EMAIL PROTECTED]>
Crossposted-To: comp.unix.programmer,comp.os.linux.development
Subject: Do "Lions' Commentary on UNIX" good for knowing unix kernal?
Date: Tue, 19 Dec 2000 12:38:15 +0800
>From many classic review, the book "Lions' Commentary on UNIX 6th
edition : with source code " is the most excellent point of learn unix
system. So I borrow it from my library, and then I find out that it is
the source code with comment, as it state, but nothing more. Seen to me
that it is a bit harder to read because I am a java programmer. Only
learn C, ASM and Unix programming at college, with really less
experience of these stuff. Do this book still suitable for me? or is
there are better choice to learn more about Unix kernal?
------------------------------
From: [EMAIL PROTECTED] (Joe Humrickhouse)
Crossposted-To: comp.unix.programmer,comp.os.linux.development
Subject: Re: Do "Lions' Commentary on UNIX" good for knowing unix kernal?
Date: 19 Dec 2000 05:35:06 GMT
Reply-To: [EMAIL PROTECTED]
On Tue, 19 Dec 2000 12:38:15 +0800, Carfield Yim
<[EMAIL PROTECTED]> wrote:
> From many classic review, the book "Lions' Commentary on UNIX 6th
> edition : with source code " is the most excellent point of learn unix
> system. So I borrow it from my library, and then I find out that it is
> the source code with comment, as it state, but nothing more. Seen to me
> that it is a bit harder to read because I am a java programmer. Only
> learn C, ASM and Unix programming at college, with really less
> experience of these stuff. Do this book still suitable for me? or is
> there are better choice to learn more about Unix kernal?
Try these:
_The Design and Implementation of the 4.3BSD UNIX Operating System_ by
Leffler, McKusick, Karels and Quarterman
_Operating Systems Design and Implementation_ by Tanenbaum and
Woodhall
_The Design of the UNIX Operating System_, Bach
--
Joe Humrickhouse
[EMAIL PROTECTED]
www.itlabs.umn.edu/~humr0002
------------------------------
From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: Can not open a file within a kernel module
Date: Tue, 19 Dec 2000 06:59:26 +0100
Rui Antunes wrote:
>
> I'm developping a kernel module for RedHat 7.0.
> I'm having problems opening files.
> I use something like this:
>
> #include <asm/uaccess.h>
>
> extern long sys_call_table[];
> int (*open)(const char* filename, int flags);
>
> int init_module() {
>
> /* .... */
> opencall = sys_call_table[_NR_open];
> /* .... */
> }
>
> int tryopen() {
>
> int fd;
> mm_segment_t oldfs;
>
> /* "switch" to user space */
> oldfs = get_fs();
> setfs(get_ds());
>
> /* open file */
> fd = opencall("file.txt",O_RDONLY);
>
> /* "switch" back */
> set_fs(oldfs);
>
> if(fd<0) printk("\nopen failed");
> }
>
> I alway get the "open failed" message...
> I even tried to use the errno variable but... I COULDN'T
> (when I insmod the module it returns unresolved symbol errno
> even after I included /usr/src/linux/include/linux/errno.h)
>
> What am I doing wrong?
>
> Thanks in advance,
> Rui Antunes
There is no errno variable in Linux. An errno variable is not
thread safe, and might give other problems as well. Instead
all functions encode error conditions in the return value, on
error the return value is int the interval -1 to -MAX_ERROR.
Because the ansi C standard specifies an errno variable it is
implemented in a shared library.
The error you get is probably that the systemcall expects a
pointer to a string in user space and gets a pointer to a
string in kernel space. In that case sys_open returns -EFAULT.
Also notice that sys_open opens a file on behalf of the
current process, which is a bad idea unless you have some
kind of agreement with that process.
--
Kasper Dupont
------------------------------
From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: Kernel say: Unable to open initial console
Date: Tue, 19 Dec 2000 07:20:31 +0100
Pulec wrote:
>
> What can I do, why kernel say: Unable to open initial console
Doesn't it say more than that?
That is because there is no /dev/console on your
root filesystem. In most cases that is because you
are using the wrong disk/partition for root. But
if you are using the wrong filesystem the kernel
will most likely not find the init program either,
which it should report.
If the kernel also says: "No init found. Try
passing init= option to kernel." then you are
probably using the wrong root system try passing
a root=xxx option to the kernel where xxx is the
device number of the correct filesystem.
If the init program is found it will be started
but will not be able to report any problems because
of the missing console. In that case try using a
rescure disk and create the /dev/console with the
command: mknod /.../dev/console c 5 1
where ... is replaced with the mount point of the
root filesystem.
--
Kasper Dupont
------------------------------
From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: Open file in module?
Date: Tue, 19 Dec 2000 07:27:20 +0100
Naushit Sakarvadia wrote:
>
> Hi
>
> How do I open a file in module..I need to open one text file from module
> I am writing...
>
> can I use alll standard file system call like Open , Close write read
> etc..etc.. from module?
>
> Thanks
No you cannot use open and friends within the kernel.
Why do want to open a file? If you tell a litle more
about your problem you will probably get a lot of
ideas.
It is posible to do read and write files from the
kernel using the sys_open and friends, but that is
not the way to do it. The correct way to do it if
you really want is more complicated.
--
Kasper Dupont
------------------------------
From: Kasper Dupont <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.hardware,comp.os.linux.advocacy
Subject: Re: Intel Easy PC camera - cannot be supported in Linux!
Date: Tue, 19 Dec 2000 07:51:50 +0100
jtnews wrote:
>
> The Intel Easy PC camera is not supported in Linux!
> You can't even write a driver for it!
>
> I got it as a "free" add-on with my new Dell Dimension
> L600cx, but now it seems I made the wrong choice!
>
> Why does a $40 cheapo camera have to be proprietary for
> Intel? I thought Intel made all their money because they make
> huge volumes of flash memory chips over their competitors.
>
> I better choose the Lexmark color printer as a free add on next
> time!
>
Of course it is posible to write a driver for that
camera, but you would have to reverse engineer the
protocols.
Depending on how it is connected you could hook in
a piece of hardware or software to watch the
communication.
I don't understand Intel's policy, a Linux driver
would allow more people to use the camera and then
they could expect to sell more cameras. But
perhaps they have some secret agreement with MS.
--
Kasper Dupont
------------------------------
Crossposted-To: comp.lang.c++,gnu.misc.discuss
Subject: Re: Compiling C++ programs with GCC --> no GPL license implications
From: [EMAIL PROTECTED] (Peter Seebach)
Date: 19 Dec 2000 07:08:48 GMT
In article <[EMAIL PROTECTED]>,
E. Robert Tisdale <[EMAIL PROTECTED]> wrote:
>Last time I checked, the President of the United States
>was elected by the United States Supreme Court.
No, he was elected by electors, based on rulings made by a number of
courts and lawyers.
It's always annoying when a system of laws is actually *used*.
-s
--
Copyright 2000, All rights reserved. Peter Seebach / [EMAIL PROTECTED]
C/Unix wizard, Pro-commerce radical, Spam fighter. Boycott Spamazon!
Consulting & Computers: http://www.plethora.net/
------------------------------
From: Richard Kolb <[EMAIL PROTECTED]>
Subject: Re: Open file in module?
Date: Tue, 19 Dec 2000 09:16:17 +0200
Hi Naushit,
The general rule about opening files in the kernel is don't,
This may seem stupid, but if you really want to open a file maybe try to
write a daemon,
If a daemon meets your requirements, trust me on this , it will be much
easier to write/debug and port to other platforms.
Richard.
Naushit Sakarvadia wrote:
> Hi
>
> How do I open a file in module..I need to open one text file from module
> I am writing...
>
> can I use alll standard file system call like Open , Close write read
> etc..etc.. from module?
>
> Thanks
------------------------------
From: Josef Moellers <[EMAIL PROTECTED]>
Subject: Re: How to ensure a page not being swapped out
Date: Tue, 19 Dec 2000 08:21:33 +0100
Richard Kolb wrote:
> /*
> * Now we acquire the request spinlock, we have to be mega careful
> * not to schedule or do something nonatomic
> */
This probably hasn't to do with swapping but with switching a context
while holding a spinlock.
If you acquire a spinlock and switch context, you have no control
whatsoever over what happens while you hold the spinlock. The other task
may choose to acquire the very same spinlock and the system will stall.
-- =
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize (T. Pratchett)
------------------------------
From: [EMAIL PROTECTED]
Subject: Re: how to use raw device
Date: Tue, 19 Dec 2000 07:23:51 GMT
Paul Repacholi <[EMAIL PROTECTED]> writes:
> [EMAIL PROTECTED] (Kaz Kylheku) writes:
>> Databases that run on proprietary UNIX systems do use the raw
>> devices; when ported to Linux, these applications could benefit if
>> they could also use raw devices in that environment.
> The main ( traditional ) reason was the unix file system. It was
> designed to spread larger files over the disk so as to ensure 'fair'
> access. Ext2 does not have this 'feature'. If you have a UFS system,
> and run a DB in the file system, read the TUNEFS manpage now. Same
> goes for swap, btw.
> However, useing memory twice to buffer data, in the kernebuffers and
> in the DB is not a good idea for apps like DBs that want every byte
> of memory they can get.
If you take a look at Gray & Reuter, you'll find that the main issue
for database applications is _not_ that of memory consumption, but
rather that of robustness.
The "traditional" reason to eschew UFS has little to do with "fairness
of access," and a whole lot to do with the fact that between UFS,
metadata, and cacheing, it is difficult-to-impossible to guarantee
that transaction logs can be kept consistent.
[These days, increasingly smart disk drives make the task increasingly
difficult too...]
The _critical_ thing about an RDBMS is that of making sure that you
control exactly what data has been updated where. Guarantees of
robustness even in the face of hardware failures requires that your
application has pretty draconian control over what updates take what
priority.
And THAT is where raw partitions give the crucial bit of extra
control. They're not cached, so you can control _exactly_ when the
data gets updated, reordering as needed to ensure correctness.
--
(reverse (concatenate 'string "ac.notelrac.teneerf@" "454aa"))
<http://www.ntlug.org/~cbbrowne/>
"In computing, invariants are ephemeral." -- Alan Perlis
------------------------------
From: Josef Moellers <[EMAIL PROTECTED]>
Crossposted-To: comp.unix.programmer,comp.os.linux.development
Subject: Re: Do "Lions' Commentary on UNIX" good for knowing unix kernal?
Date: Tue, 19 Dec 2000 08:30:26 +0100
Carfield Yim wrote:
> =
> From many classic review, the book "Lions' Commentary on UNIX 6th
> edition : with source code " is the most excellent point of learn unix
> system. So I borrow it from my library, and then I find out that it is
> the source code with comment, as it state, but nothing more. Seen to me=
> that it is a bit harder to read because I am a java programmer. Only
> learn C, ASM and Unix programming at college, with really less
> experience of these stuff. Do this book still suitable for me? or is
> there are better choice to learn more about Unix kernal?
Although it is a tad outdated, yes, it is a good introduction to UN*X
kernel internals. OTOH I have also seen a book much like the Lion's,
based on Linux: "Linux Core Kernel Commentary" by Scott Maxwell
(CoriolisOpen Press, ISBN 1-57610-469-9). I have inherited the book from
a colleague who has left the department but, so far, I have not looked
through it, so I can't judge whether it is of any use.
Of course, Joe Humrickhouse's recommendations are good books, too.
-- =
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize (T. Pratchett)
------------------------------
From: Josef Moellers <[EMAIL PROTECTED]>
Subject: Re: how to use raw device
Date: Tue, 19 Dec 2000 08:54:50 +0100
[EMAIL PROTECTED] wrote:
> And THAT is where raw partitions give the crucial bit of extra
> control. They're not cached, so you can control _exactly_ when the
> data gets updated, reordering as needed to ensure correctness.
But sometimes even the caching of hard drives makes controlling of what
is written when extremely difficult, to the extent that in certain
environments or for certain data structures, switching off drive caching
might be necessary.
-- =
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize (T. Pratchett)
------------------------------
From: Arne Driescher <[EMAIL PROTECTED]>
Subject: Re: Open file in module?
Date: Tue, 19 Dec 2000 08:58:37 +0100
Naushit Sakarvadia wrote:
>
> Hi
>
> How do I open a file in module..I need to open one text file from module
> I am writing...
>
> can I use alll standard file system call like Open , Close write read
> etc..etc.. from module?
As others have mentioned: This is a bad idea. If you can work around
don't do to.
If there is no way around:
1) If you only want to read a file (e.g. firmware) link it directly to
the driver.
2) Consider an user space deamon accessing your driver by normal
read/write or ioctl calls.
3) Use the /proc-fs to exchange data.
4) If you really _must_ use file access in the driver study
/usr/src/linux/drivers/sound/sound_firmware.c
for an example.
-Arne
------------------------------
From: Arne Driescher <[EMAIL PROTECTED]>
Subject: Re: Can not open a file within a kernel module
Date: Tue, 19 Dec 2000 09:10:35 +0100
Kasper Dupont wrote:
>
> Rui Antunes wrote:
> >
> > I'm developping a kernel module for RedHat 7.0.
> > I'm having problems opening files.
> > I use something like this:
> >
> > #include <asm/uaccess.h>
> >
> > extern long sys_call_table[];
> > int (*open)(const char* filename, int flags);
> >
> > int init_module() {
> >
> > /* .... */
> > opencall = sys_call_table[_NR_open];
> > /* .... */
Does not look too bad :-)
But I had to use __NR_open (_two_ underscores).
Perhaps it helps ;-)
-Arne
------------------------------
Crossposted-To: comp.lang.c++,gnu.misc.discuss
Subject: Re: Compiling C++ programs with GCC --> no GPL license implications
From: Tor Slettnes <[EMAIL PROTECTED]>
Date: Tue, 19 Dec 2000 08:49:47 GMT
>>>>> "Tor" == Tor Slettnes <[EMAIL PROTECTED]> writes:
>>>>> "HomerWelch" == HomerWelch <[EMAIL PROTECTED]> writes:
HomerWelch> Oh, is Al Gore President?
Tor> Yes.
Sorry, I read "vice president". That he is.
No flame or confusion intended. :-/
-tor
------------------------------
From: "Jeffrey B. Siegal" <[EMAIL PROTECTED]>
Crossposted-To: comp.lang.c++,gnu.misc.discuss
Subject: Re: Compiling C++ programs with GCC --> no GPL license implications
Date: Tue, 19 Dec 2000 01:09:30 -0800
"E. Robert Tisdale" wrote:
> > Last time I checked,
> > your President is not elected by overall popular vote.
> > Tell your elected representatives
> ? to change the system if you don't like it.
>
> Last time I checked, the President of the United States
> was elected by the United States Supreme Court.
Were it not for the Supreme Court, he might well have been "elected" by
the Florida Legislature, since that is what the Consitution says, right?
Show me where in the Constitution it says that voters vote for President
*at all*.
------------------------------
From: lavender <[EMAIL PROTECTED]>
Subject: about __free_pages_ok()
Date: Tue, 19 Dec 2000 10:32:09 +0800
�o�O MIME �榡���h���q�l��C
==============015B9A6C7A9F6D68E5233960
Content-Type: text/plain; charset=big5
Content-Transfer-Encoding: 7bit
hi:
my code is from 2.4.0-test11
in this functions called by init_mem()
there is one line here:
zone->free_pages-=mask;
I think this means that we are counting the free pages number
if it's true, when we enter the while loop later
if (!test_and_change_bit(index, area->map))
break;
but why can we directly break this loop and leave the free_pages
counted ??
thank you
--lavender
==============015B9A6C7A9F6D68E5233960
Content-Type: text/x-vcard; charset=big5;
name="lavender.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for lavender
Content-Disposition: attachment;
filename="lavender.vcf"
begin:vcard
n:Wu;lavender
x-mozilla-html:FALSE
org:embsol;
adr:;;;;;;
version:2.1
email;internet:[EMAIL PROTECTED]
title:software engineer
x-mozilla-cpt:;0
fn:lavender Wu
end:vcard
==============015B9A6C7A9F6D68E5233960==
------------------------------
From: [EMAIL PROTECTED] (Bart De Schuymer)
Subject: IEEE standards
Date: Tue, 19 Dec 2000 09:27:51 GMT
Hello,
I've been looking at the IEEE homepage (www.ieee.com).
I would like to read the standard called:
IEEE 802.1 Spanning-Tree Protocol
but it seems I have to pay to read a standard ??
I ask this here because this standard is used in the kernel (bridging)
and I've been staring at it for too long ;-).
So am I correct there is no way to read the discription of this
protocol without paying? (I've been searching the web for hours to
find a good explanation of the protocol)
bART
------------------------------
From: Eric <[EMAIL PROTECTED]>
Subject: Re: How to ensure a page not being swapped out
Date: Tue, 19 Dec 2000 10:40:28 +0100
Reply-To: [EMAIL PROTECTED]
Thomas Petazzoni wrote:
>
> > Does anyone know here what flag is required to ensure that a kmalloc'ed
> > page isn't swapped out?
> > Is GFP_KERNEL sufficient, or do I need GFP_ATOMIC (or even GFP_DMA)
>
> what does the flags GFP_KERNEL and GFP_ATOMIC exactly do ?
> i've already read the manpages, but i need more explanations about how
> they exactly work.
>
I did the same and wasn't sure either. (not much in
/usr/src/linux/include/linux/mm.h either)
I got a great hint to try the book "writing linux device drivers" of
alessandro rubini.
I know it's lying around here somewhere. It has helped me before, so
I'll give that a try.
If you really want some good info (I don't know about this subject yet),
try to get that book.
Eric
------------------------------
From: [EMAIL PROTECTED] (Stefaan A Eeckels)
Subject: Re: Compiling C++ programs with GCC --> no GPL license implications
Crossposted-To: comp.lang.c++,gnu.misc.discuss
Date: Tue, 19 Dec 2000 10:00:37 +0100
In article <[EMAIL PROTECTED]>,
"E. Robert Tisdale" <[EMAIL PROTECTED]> writes:
> Stefaan A Eeckels wrote:
>
>> Last time I checked,
>> your President is not elected by overall popular vote.
>> Tell your elected representatives
>> to change the system if you don't like it.
>
> Last time I checked, the President of the United States
> was elected by the United States Supreme Court.
>
> He's NOT my President.
That's a very sad statement. You might have preferred
Al Gore, and you probably voted for him, but part of
the deal in a democracy is that the winner of the election
is _everybody's_ President. The simple fact is that
something extremely unlikely happened (a couple of hundred
votes difference on 6M cast), and that such an occurrence,
by (Florida) law, requires a recount, which turned out to
be a mess, due to voting machine and ballot design problems.
It's normal that cases where people cannot find a common
ground are dealt with by the courts --it's their basic
function.
IMHO, ballots which were not obviously correct should have
been discounted. There's a definite onus on the voter to
ensure that his/her selection is _clearly_ evident from
the ballot paper. The moment you start trying to guess what
the intention might have been, you're in trouble, as the
Florida farce clearly proved.
Praise yourself lucky you've got a system that works, and
stop making stupid statements. Like him or not, George Bush is
_your_ President. It does not matter whether he won by 570
votes, or 570,000. If you can only accept a President (or
senator, or congresperson or mayor...) when you've voted for
them, then _you_ are a danger for any form of democracy.
Take a leaf out of Al Gore's book --disagree with the ruling,
but accept it.
--
Stefaan
--
Ninety-Ninety Rule of Project Schedules:
The first ninety percent of the task takes ninety percent of
the time, and the last ten percent takes the other ninety percent.
------------------------------
** 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 by posting to the
comp.os.linux.development.system newsgroup.
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
******************************