Linux-Development-Sys Digest #566, Volume #8     Wed, 14 Mar 01 19:13:13 EST

Contents:
  adding a lot of syscalls (Julien Cavoizy)
  Re: How to use C++ to develope kernel module? (Villy Kruse)
  what means pgrp in the task struct ? (Julien Cavoizy)
  Kmalloc (Mikael Chambon)
  Re: signal.c (Mikael Chambon)
  Re: How to use C++ to develope the linux driver module? ("Peter T. Breuer")
  Re: I/O port accessing problems (Iwo Mergler)
  Re: Kmalloc ("Joseph A. Knapka")
  Re: How to use C++ to develope the linux driver module? (Joe Pfeiffer)
  kernel panic with IKD ("Omkar Sathe")
  Re: Can linux be trusted? (Curtis Schofield)
  Continuing NFS problems, thru Linux Kernel 2.4.2? (Peter Mardahl)
  Re: Continuing NFS problems, thru Linux Kernel 2.4.2? (Kaz Kylheku)
  Re: Setting Linux Disk Buffer Cache (Roland Smith)
  Re: How to count a period of time? (Roland Smith)
  Re: Can linux be trusted?
  Re: Continuing NFS problems, thru Linux Kernel 2.4.2? (Peter Mardahl)
  Re: Linux device programming and control
  Re: How to use C++ to develope kernel module? (Johan Kullstam)
  Unexpected scheduler behaviour ? (Pieter Thysebaert)

----------------------------------------------------------------------------

From: Julien Cavoizy <[EMAIL PROTECTED]>
Subject: adding a lot of syscalls
Date: Wed, 14 Mar 2001 17:20:32 +0100

hi,

I am under a Mandrake 7.2 distribution and i want to add some syscalls
in the kernel. My problem is that in the asm/unistd.h there are about 5
syscalls which are not written in the entry.S file. So the number of
these syscalls go to 197 but in the entry.S the number of the syscall
table stop to 191.

So i tried to add one syscall with a number 198 in unistd.h and write
198 to the limit in entry.S but it doesn't work.
What should i do ?

the strange syscalls in unistd.h are the followings ...
...
#define __NR_mmap2              192
#define __NR_truncate64         193
#define __NR_ftruncate64        194
#define __NR_stat64             195
#define __NR_lstat64            196
#define __NR_fstat64            197

thank for your answer

Julien

[EMAIL PROTECTED]

------------------------------

From: [EMAIL PROTECTED] (Villy Kruse)
Subject: Re: How to use C++ to develope kernel module?
Date: 14 Mar 2001 16:28:12 GMT

On Wed, 14 Mar 2001 15:15:21 GMT, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>Derek Viljoen <[EMAIL PROTECTED]> writes:
>> You can't do C++ in the kernel.
>
>Well, it's _theoretically_ possible, and might have certain _slight_
>advantages over just plain C.
>
>However, those slight advantages are _heavily_ overweighed by the
>_massive_ disadvantages:
>


A few of the 0.99 releases was actualy compiled with C++.

The #define for asmlinkage in /usr/src/linux/include/linux/linkage.h
is leftover from that.


Villy

------------------------------

From: Julien Cavoizy <[EMAIL PROTECTED]>
Subject: what means pgrp in the task struct ?
Date: Wed, 14 Mar 2001 17:39:20 +0100

hi,

I am trying to understand the the task struct in the sched.h file and i
don't know what is the pgrp field and what it is used to ?

thank for your answer

Julien

[EMAIL PROTECTED]

------------------------------

From: Mikael Chambon <[EMAIL PROTECTED]>
Subject: Kmalloc
Date: Wed, 14 Mar 2001 17:58:16 +0100


Hi,

Just a question, when you prpgram in the kernel,
when do you have to use kmalloc ??  Can't we use malloc ?

In the case I must use kmalloc, which priority should I use ??


Thanks for all,

Best regards,


Mikael Chambon

------------------------------

From: Mikael Chambon <[EMAIL PROTECTED]>
Subject: Re: signal.c
Date: Wed, 14 Mar 2001 18:00:47 +0100

Josef Moellers wrote:
> 
> Mikael Chambon wrote:
> >
> > Hi
> >
> > What does it mean to kill the process 0 ??
> 
> From the on-line manual (man IS your friend B-{)
> 
>        If pid equals 0, then sig is sent to every process in  the
>        process group of the current process.
> 
> Does this answer the rest of your questions?
> 
> > As far as I know there is no process 0, but when you look in kernel/signal.c
> > in the function kill_something_info() is the pid is 0  there is a return
> > kill_pg_info(sig, info, current->pgrp)
> >
> > Does someone know why ??
> >
> > Does someone could explain me what is the pgrp in the task_struct ??
> >
> > thanks for all !!!
> 
> A votre service,
> 
> --
> Josef M�llers (Pinguinpfleger bei FSC)
>         If failure had no penalty success would not be a prize
>                                                 -- T.  Pratchett


Oups sorry, thanks for all,

Mikael

------------------------------

From: "Peter T. Breuer" <[EMAIL PROTECTED]>
Subject: Re: How to use C++ to develope the linux driver module?
Date: Tue, 13 Mar 2001 14:01:28 +0100

O.Petzold <[EMAIL PROTECTED]> wrote:
> "Peter T. Breuer" wrote:

>> <[EMAIL PROTECTED]> wrote:
>> >   Can  C++  be used in developing kernel module? and if yes, how
>>
>> No (short answer).
>>
>> > can I do to fix the problems?
>>
>> You can implement C++ memory and exception handling in the kernel.
>> Etc.
> do you have the code for exception handling in kernel space ? This is

Do you?

Peter

------------------------------

From: Iwo Mergler <[EMAIL PROTECTED]>
Subject: Re: I/O port accessing problems
Date: Wed, 14 Mar 2001 18:22:57 +0000
Reply-To: [EMAIL PROTECTED]

Matt wrote:
> 
> I'm currently writing a driver for a card that has some RAM on it. To read
> from the RAM, I write the address I want to the first two ports, (0x300),
> and then read the value from the next two ports, (0x302).
> 
> The problem is every inw() call returns -1. I've requested the I/O region
> for four ports, and /proc/ioports shows my driver bagging those ports
> correctly. I thought it might be my driver, but I tried at a different
> address, (which has no hardware connected), and I get the same effect.
> 
> I'm reading the values into a variable of type __s16 which should be the
> right size and I didn't think I had to do anything extra after requesting
> the I/O region.
> 
> Is -1 the standard response to reading an "open" port? In which case, I
> should check to make sure the evaluation board isn't duff.

You're right, -1 is returned if your ISA card is not responding. Just means
all bits stay at 1. 

Iwo

------------------------------

From: "Joseph A. Knapka" <[EMAIL PROTECTED]>
Subject: Re: Kmalloc
Date: Wed, 14 Mar 2001 18:08:44 GMT

Mikael Chambon wrote:
> 
> Hi,
> 
> Just a question, when you prpgram in the kernel,
> when do you have to use kmalloc ??  Can't we use malloc ?

No! None of your standard libc friends are avialable within
the kernel. That's why printk(), kmalloc(), etc. exist.

> In the case I must use kmalloc, which priority should I use ??

Read the commentary in mm/slab.c re. kmalloc(). Probably you
want GFP_ATOMIC if you're allocating within a device driver.
Otherwise, just choose whatever is appropriate.

HTH,

-- Joe

> Thanks for all,
> 
> Best regards,
> 
> Mikael Chambon

-- Joe Knapka
"It was just a maddened crocodile hidden in a flower bed. It could
 have happened to anyone." -- Pratchett

------------------------------

From: Joe Pfeiffer <[EMAIL PROTECTED]>
Subject: Re: How to use C++ to develope the linux driver module?
Date: 14 Mar 2001 10:49:55 -0700

[EMAIL PROTECTED] (Kaz Kylheku) writes:
> >
> >You have to use a subset of C++ that basically does without all the
> >reasons most people would want to use C++ (as Peter points out, though
> 
> Actually that is false; you can use templates, operator overloading,
> multiple inheritance, virtual functions, abstract base classes etc.
> Global construction and exception handling, the two things you can't
> use, are *not* all the reasons people use C++.

Good point.  I guess it would be better to say you'd have to do
without several of the major reasons you'd want to use it.
-- 
Joseph J. Pfeiffer, Jr., Ph.D.       Phone -- (505) 646-1605
Department of Computer Science       FAX   -- (505) 646-1002
New Mexico State University          http://www.cs.nmsu.edu/~pfeiffer
SWNMRSEF:  http://www.nmsu.edu/~scifair

------------------------------

From: "Omkar Sathe" <[EMAIL PROTECTED]>
Subject: kernel panic with IKD
Date: Wed, 14 Mar 2001 14:31:35 -0500

Hello,

I installed IKD patches today for 2.2.12 kernel,

After I booted the machine with the new kernel, after LILO started loading
the image, it gave the error:

kernel panic: VFS: Unable to mount root fs on 08:01

Any ideas ?

TIA

Omkar Sathe



------------------------------

From: [EMAIL PROTECTED] (Curtis Schofield)
Crossposted-To: 
comp.lang.c,comp.os.linux.development.apps,comp.sys.be.programmer,comp.sys.mac.programmer.misc,comp.unix.bsd.freebsd.misc,comp.unix.bsd.misc,gnu.gcc,linux.dev.gcc
Subject: Re: Can linux be trusted?
Date: 14 Mar 2001 19:51:42 GMT
Reply-To: [EMAIL PROTECTED]

In article <[EMAIL PROTECTED]>, Stefaan A Eeckels wrote:
>In article <[EMAIL PROTECTED]>,
>       James Richard Tyrer <[EMAIL PROTECTED]> writes:
>> Stefaan A Eeckels wrote:
>> 
>>> Agreed. Division by zero should yield the appropriate error.
>> 
>> Note that with the IEEE numeric standard that floating point division i
>> by 0 is legal since the result is true infinity not just the standard 
>> fix up which is the largest number that can be represented.
>
>I'm not an expert on IEEE numeric standards -- has infinity a 
>representation or is it just NaN?
>

infinity has a representation as well.

-- 
Curtis Schofield                                http://www.angrycandy.net

Treasurer, Undergraduate Association of Computing Science.
"that's frank, we don't know about frank.. " - Kimberly Pawlyna

------------------------------

From: [EMAIL PROTECTED] (Peter Mardahl)
Subject: Continuing NFS problems, thru Linux Kernel 2.4.2?
Date: 14 Mar 2001 21:06:41 GMT

Hello,

  I'm using RedHat linux 7.0, and I'm having problems with NFS locking.
On startup, I get this error message:

Starting NFS file locking services: 
Starting NFS lockd: lockdsvc: Invalid argument
                                                           [FAILED]

This error may be normal for a system which is running 2.4.2:  lockd
seems to be running

 ps aux | grep lockd                                         
root       405  0.0  0.0     0    0 ?        SW   Mar05   0:00 [lockd]


  However, when a Digital UNIX 4.0D client tries to lock a file on a 
Linux 2.4.2
NFS server, this problem occurs:

Mar 12 22:37:54 tesla binmail[29820]: cannot lockf /usr/spool/mail/peterm


What resources I have found on the net so far suggest using "nolock" as a
 NFS mount option.    However, Digital UNIX does not provide that
option.

Can anyone advise me on how to fix this locking problem, or is it simply a bug in the
Linux kernel?

PeterM

------------------------------

From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: Continuing NFS problems, thru Linux Kernel 2.4.2?
Reply-To: [EMAIL PROTECTED]
Date: Wed, 14 Mar 2001 21:12:35 GMT

On 14 Mar 2001 21:06:41 GMT, Peter Mardahl <[EMAIL PROTECTED]> wrote:
>Hello,
>
>  I'm using RedHat linux 7.0, and I'm having problems with NFS locking.
>On startup, I get this error message:
>
>Starting NFS file locking services: 
>Starting NFS lockd: lockdsvc: Invalid argument

Did you compiler the NFS server support into your kernel? nfsd and
lockd are in the kernel; the lockdsvc is essentially a system call that
a user space host program uses to enter into the service function in
the kernel.

------------------------------

Subject: Re: Setting Linux Disk Buffer Cache
From: Roland Smith <[EMAIL PROTECTED]>
Date: 14 Mar 2001 22:21:56 +0100

Andries Engelbrecht <[EMAIL PROTECTED]> writes:

> Is it possible to set Linux to use a certain amount of RAM for disk buffer 
> cache or a percentage of total RAM for this purpose?

Yes.

> If so, how can I do it?

You can change the percentage used by writing three values to
/proc/sys/vm/buffermem

The values are: (excerpted from
/usr/src/linux/Documentation/filesystems/proc.txt)

min_percent
===========
This is  the  minimum  percentage  of  memory  that  should be spent on buffer
memory.

borrow_percent
==============
When Linux is short on memory, and the buffer cache uses more than it has been
allotted, the  memory  management  (MM)  subsystem will prune the buffer cache
more heavily than other memory to compensate.

max_percent
===========
This is the maximum amount of memory that can be used for buffer memory.

On my system, the defaults are:

slacker:~$ cat /proc/sys/vm/buffermem 
2       10      60

Roland

-- 
Roland Smith                        "When life hands you a lemon,
r s m i t h @ x s 4 a l l . n l      make lemonade."
http://www.xs4all.nl/~rsmith/

------------------------------

Subject: Re: How to count a period of time?
From: Roland Smith <[EMAIL PROTECTED]>
Date: 14 Mar 2001 22:35:32 +0100

Derek Viljoen <[EMAIL PROTECTED]> writes:

> use gettimeofday().
> 
> InterFan wrote:
> 
> > I want to count a period of time in my program. I want the time be
> > precise to 1/1000 seconds.
> > I think the function "time()" can't be used to solve it. And I tried
> > function "clock(()".
> > But this function just return "0".
> > How will I do?
> > thanks.
> > 
> > 
> > Best Regards,
> > Chuan He

On Linux, gettimeofday and other timers have a precision of 1/100 of a
second (see /usr/include/bits/time.h).

The only way of getting a higher timer resolution is accessing some
machine-specific registers available on Pentium and newer processors.

You can find them in the file msr.h in the kernel source code (in the
include/asm-i386/ directory). Usage is something like:

long long t0, t1; /* long long is a GNU extension! */

rdtscll(t0);
/* do something you want to time. */
rdtscll(t1);

printf ("%Ld clock ticks\n", t1-t0);

Hope this helps,

Roland
-- 
Roland Smith                        "When life hands you a lemon,
r s m i t h @ x s 4 a l l . n l      make lemonade."
http://www.xs4all.nl/~rsmith/

------------------------------

From: [EMAIL PROTECTED] ()
Crossposted-To: 
comp.lang.c,comp.os.linux.development.apps,comp.sys.be.programmer,comp.sys.mac.programmer.misc,comp.unix.bsd.freebsd.misc,comp.unix.bsd.misc,gnu.gcc
Subject: Re: Can linux be trusted?
Date: Wed, 14 Mar 2001 21:45:40 -0000

In article <[EMAIL PROTECTED]>, Willam Hughes  <me> wrote:

>The question of how you store your floating point numbers
>(e.g. implicit leading 1 or not) has nothing to do with
>whether a given real number x has an exact binary
>representation.  (clearly all integers have an exact
>binary representation).

But we are not speaking of integers.  How floating point represents
a number is what is important here.  

How do you think 0.3 is represented in IEEE floating point?

--
http://www.spinics.net/linux

------------------------------

From: [EMAIL PROTECTED] (Peter Mardahl)
Subject: Re: Continuing NFS problems, thru Linux Kernel 2.4.2?
Date: 14 Mar 2001 21:46:50 GMT

Yes, NFS server support is compiled into the kernel.
I can mount the filesystem remotely AND I can read the
files on it.  However, Digital UNIX cannot lock files on it.

PeterM


In article <[EMAIL PROTECTED]>,
Kaz Kylheku <[EMAIL PROTECTED]> wrote:
>On 14 Mar 2001 21:06:41 GMT, Peter Mardahl <[EMAIL PROTECTED]> wrote:
>>Hello,
>>
>>  I'm using RedHat linux 7.0, and I'm having problems with NFS locking.
>>On startup, I get this error message:
>>
>>Starting NFS file locking services: 
>>Starting NFS lockd: lockdsvc: Invalid argument
>
>Did you compiler the NFS server support into your kernel? nfsd and
>lockd are in the kernel; the lockdsvc is essentially a system call that
>a user space host program uses to enter into the service function in
>the kernel.



------------------------------

From: [EMAIL PROTECTED] ()
Subject: Re: Linux device programming and control
Date: Wed, 14 Mar 2001 21:55:58 -0000

In article <[EMAIL PROTECTED]>,
Aminudin Khalid  <[EMAIL PROTECTED]> wrote:

>If we are developing a program that will control a PCI devices, normally
>we use the "<linux/pci.h>"  functions
>and structs . What should I use if I want to control  ISA device or AMR
>devices ?Does  linux provide any specific
>library to  control and access these kind of peripherals ?

Have you looked at some sources yet?  There are a lot of examples
in the kernel distribution.

--
http://www.spinics.net/linux/


------------------------------

Subject: Re: How to use C++ to develope kernel module?
From: Johan Kullstam <[EMAIL PROTECTED]>
Date: Wed, 14 Mar 2001 23:25:34 GMT

[EMAIL PROTECTED] (Villy Kruse) writes:

> On Wed, 14 Mar 2001 15:15:21 GMT, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> >Derek Viljoen <[EMAIL PROTECTED]> writes:
> >> You can't do C++ in the kernel.
> >
> >Well, it's _theoretically_ possible, and might have certain _slight_
> >advantages over just plain C.
> >
> >However, those slight advantages are _heavily_ overweighed by the
> >_massive_ disadvantages:
> >
> 
> 
> A few of the 0.99 releases was actualy compiled with C++.

but wasn't that mostly using the intersection of C and C++ rather than
using C++ specific features?  i seem to vaguely recall claims to the
effect that g++ had better (or some additional useful) warnings when
compared to the gcc at the time.

(btw imho if a C++ compiler compiles it and it runs as expected, it
*is* C++ no matter how much you quibble about the style and regardless
of whether it is also valid C code.)

> The #define for asmlinkage in /usr/src/linux/include/linux/linkage.h
> is leftover from that.
> 
> 
> Villy

-- 
J o h a n  K u l l s t a m
[[EMAIL PROTECTED]]
Don't Fear the Penguin!

------------------------------

From: [EMAIL PROTECTED] (Pieter Thysebaert)
Subject: Unexpected scheduler behaviour ?
Date: 14 Mar 2001 12:55:34 GMT

Don't know if this the right group but anyway, here goes :

I'm trying to time some CORBA-related code in function of CPU load as
follows :

On the computer the servant is located , I run a self-written utility that
uses processor time - all it does is execute a loop with floating-point
instructions followed by a usleep() , and these things are themselves
contained within an infinite loop.

I run the client o nanother computer.
This client calls the same function on the servant object 1000 times, and
measures how long each call takes.

In the end it divides the accumulated time by 1000 to get an estimate of
the average time a call needs.

So what I do is execute the utility, specifying the number of iterations
for the inner loop on  the command line, when the servant is still idle
(no function called), then start the client.

(Running the utility with higher numbers will increase the cpu load)

Now I would expect that the average time for one call increases as the cpu
load increases.

However, when reaching about 40% load, the time just drops back to its
initial value i.e. the time it takes to handle a call when no extra
cpu-load is generated using my utility. (and stays there for loads > 40
%...)


So it seems that at some point, the utility is suppressed in favour of the
servant object's methods....

I have really no clue as to why this is happening...

Is there some kind of scheduling policy I am not aware of ?

This is Debian 2.2 Linux, using TAO as my orb.

The "load values" are just taken from top's output (as load = 100 -
"idle"-value - that's good enough for me)


Pieter
 

------------------------------


** 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
******************************

Reply via email to