Linux-Development-Sys Digest #60, Volume #8       Wed, 2 Aug 00 13:13:21 EDT

Contents:
  Re: Linux Device Driver compile - files missing ("Norm Dresner")
  Re: Linux Device Driver compile - files missing (Yu Jaemin)
  Re: measuring time on LINUX (David Konerding)
  Re: problem with open files (Lew Pitcher)
  Re: Intel OR840 Hang ("D. Stimits")
  Ncurses version check (Marco van de Voort)
  Timeout function ("Ram�n Ag�ero")
  Re: siginfo->si_pid and siginfo->si_gid always zero? ("Michael Schmidt")
  Re: Timeout function (Mathias Waack)
  linux device drivers info (Rafael =?iso-8859-1?Q?Garc=EDa?=)
  Re: Ncurses version check (Thomas Dickey)
  Re: Ncurses version check (Marco van de Voort)
  Re: problem with open files (root)
  Re: Timeout function (Mathias Waack)
  socket connection, please help!! (Gee)
  Are there any timerLib available ([EMAIL PROTECTED])
  Multiple System.map symlinks? (jac0b)
  read() and directories (Daniel P. Katz)
  Re: read() and directories (Fro-Man)
  Re: read() and directories (Pete Zaitcev)
  Memory Display command ("davidz")
  Re: Are there any timerLib available (Kaz Kylheku)

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

Reply-To: "Norm Dresner" <[EMAIL PROTECTED]>
From: "Norm Dresner" <[EMAIL PROTECTED]>
Subject: Re: Linux Device Driver compile - files missing
Date: Wed, 02 Aug 2000 01:34:25 GMT

You can find out about some of the kernel changes from the 2.0.x series for
which the book was written to the newer 2.2.x (which you have) at
    http://www.atnf.csiro.au/~rgooch/linux/docs/porting-to-2.2.html

And next time try looking in Deja.com's archives.  This is becoming a FAQ

    Norm

Chris Kotchey <[EMAIL PROTECTED]> wrote in message
news:8m7dk8$kpo$[EMAIL PROTECTED]...
> Simple question here:  I'm using the O'Reilly Linux Device Driver book and
> downloaded the program samples.  The code fails to compile on my system
> because it can't find the files <linux/symtab_begin.h> and
> <linux/symtab_end.h>, which should be under /usr/include, but for some
> reason, it is not there in my directories.
>
> It's the RedHat 6.2 Linux that is installed.  Can anyone tell me why these
> might not have been installed and/or what package these files should be a
> part of so I can get them added myself?
>
> Thanks!
> Chris Kotchey
>
>


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

From: Yu Jaemin <[EMAIL PROTECTED]>
Subject: Re: Linux Device Driver compile - files missing
Date: 2 Aug 2000 02:21:29 GMT

Chris Kotchey <[EMAIL PROTECTED]> wrote:
> Simple question here:  I'm using the O'Reilly Linux Device Driver book and
> downloaded the program samples.  The code fails to compile on my system
> because it can't find the files <linux/symtab_begin.h> and
> <linux/symtab_end.h>, which should be under /usr/include, but for some
> reason, it is not there in my directories.

> It's the RedHat 6.2 Linux that is installed.  Can anyone tell me why these
> might not have been installed and/or what package these files should be a
> part of so I can get them added myself?

> Thanks!
> Chris Kotchey

I also had those problems like you. I recommend you to read
'Linux Kernel Module Programming Guide'. The O'reilly book
is good, but I think LKMPG is very easy to read and very
comprehensive. You can get LKMPG from Linux Documentation Project
home page.

Jaemin


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

From: [EMAIL PROTECTED] (David Konerding)
Subject: Re: measuring time on LINUX
Date: 2 Aug 2000 05:05:45 GMT

On 1 Aug 2000 15:14:37 GMT, Bernhard Brueck <[EMAIL PROTECTED]> wrote:
>[EMAIL PROTECTED] wrote:
>> I need to measure the amount of time some code
>> path takes and need a way to get the finest time
>> stamp before and after the code.  This is for
>> LINUX on an intel 386 architecture.
>
>gettimeofday should do that.
>Perhaps you are also interested in gprof. With gprof it's possible to
>limit the profiling to single function (-f).

Actually, gettimeofday() might not have the resolution required.
Take a look into the rdtsc instruction (i586 or better?)

The following function, when compiled with optimiztion, will get inlined into
your code, giving you a very high resolution timer.

inline unsigned long long TscCounter(void) {
        unsigned long high, low;
        __asm__ __volatile__(".byte 0x0f,0x31" : "=a" (low), "=d" (high));
        return ((unsigned long long) high << 32) + low;
}

Actually, gettimeofday() might be implemented using rdtsc now.


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

From: Lew Pitcher <[EMAIL PROTECTED]>
Subject: Re: problem with open files
Date: Tue, 01 Aug 2000 18:03:16 -0400

Shankar wrote:
> 
> Hi
> 
>   >Close or compress your files so you aren't using 64GB on 70GB disk?
> 
>         But how do I close deleted files. I have tried gleaning their fds and
>  then writing separate code to shut them down/unlink them but it doesn't
>  seem to work.

There seems to be a fundamental misunderstanding here.

In Unix (and it's children) a file consists of two seperate things:
the filename, and the file data. The open()/creat()/fopen()/etc file
management functions do two things:
1) they associate a filename to a file data area, and
2) they associate a filedescriptor to the file data area.

Once opened, the filename may be removed from the filesystem by
external means, without invalidating the filedescriptor/file data
mapping. In other words, once a program has opened a file, you can
delete the file and the system will not free up the file data space.
This is because a delete (rm or unlink) only deletes the filename, and
not the file data. The file data is deleted once all links to the data
have been released. Filenames count as links, but open file
descriptors _also_ count as links.

The filespace utilities count space used by filenames (i.e. df) or
used by everything (du). Sometimes there will be a discrepancy between
the two, and that discrepancy will consist partially of deleted files
that are still open.

So, to release that space, close the files.

-- 
Lew Pitcher

Master Codewright and JOAT-in-training

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

Date: Wed, 02 Aug 2000 01:16:02 -0600
From: "D. Stimits" <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
Subject: Re: Intel OR840 Hang

Tor Arntsen wrote:
> 
> Eric Kasten <[EMAIL PROTECTED]> writes:
> >Hi,
> >
> >Has anyone managed to get linux to boot on an Intel OR840 motherboard.
> >This is a dual processor (PIII) with dual bus RDRAM.  More info
> >can be found at: http://developer.intel.com/design/wrkstn/OR840/index.htm
> >
> >Using either a 2.2.16 kernel or a 2.4.0-test4 kernel, the boot will
> >hang while "Probing PCI hardware".  If you disable PCI support
> >entirely in the linux kernel build, than it doesn't hang.
> >(not very useful without the PCI bus, but it doesn't hang).  I've also
> >tried direct vs BIOS access using the 2.2.16 kernel -- still no go
> >either way.  Compiled the kernels both with and without SMP support
> >-- didn't help.
> [...]
> 
> I have a motherboard like that (128MB RDRAM, 2x800MHz PIII).
> I do not see the PCI problems you describe.  I've booted Debian
> kernels 2.0.36, 2.0.38, 2.2.x plus self-compiled 2.2.17pre13 and
> none of them had any problems with the PCI bus.
> 
> However, I have other problems with it.  It either hangs or dies
> shortly after I access the disk.  I have an Adaptec 29160 PCI SCSI
> controller with a 18GB Quantum Atlas SCSI disk and an IDE CDROM plus
> Matrox G400 dual-head graphics board.
> If the SCSI controller is configured to acess the Quantum disk in
> synch mode (80MB/sec) then it just hangs as soon as it acesses it,
> if asynch mode it kind of works but dies after a short while (it
> even powered itself down once).  The controller worked fine in a
> Dell machine so I'm a bit stuck at the moment.
> 
> -Tor

Check /var/log/messages for "unexpected IO-APIC". If that appears, boot
with kernel option "noapic" (interrupts will be different after that,
and performance during high load will drop). Assuming you have
"unexpected IO-APIC", the drive access is only a symptom, and
mounting/umounting frequently from any controller or filesystem will
cause this (try a cd rom several times real fast). With unexpected APIC,
it can vector an IRQ to an invalid location (search the log for
"unexpected IRQ vector 217"). SuperMicro i840 boards have this problem,
I don't know what other i840's have it (it seems the manner of
connecting the APIC can make it successful or failure). If you don't
have the APIC message, ignore it...if you do, check the Documentation
subdir of the kernel source for file IO-APIC.txt for more info.

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

From: [EMAIL PROTECTED] (Marco van de Voort)
Subject: Ncurses version check
Date: 2 Aug 2000 07:21:35 GMT

We have a set of headers in Pascal for Ncurses, and are now facing
versioning problems.

We more or less solved the major ones for the subset we use, but one problem
remains: detecting the version.

It seems that ncurses 3 defines a different function for that than later
versions.

Does anybody know a good solution?

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

From: "Ram�n Ag�ero" <[EMAIL PROTECTED]>
Subject: Timeout function
Date: Wed, 2 Aug 2000 10:48:49 +0200

    Hi all,

    I need to know if there is a function within Linux kernel that allows to
execute a function after a specified length of time.

    In BSD kernel exists (timeout in kern_timeout) but I grepped the source
code of Linux kernel and I didn't find it.

    Thanks in advance...





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

From: "Michael Schmidt" <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps
Subject: Re: siginfo->si_pid and siginfo->si_gid always zero?
Date: Wed, 2 Aug 2000 11:00:47 +0200

I have the same problem with si_code and si_addr, which is always zero, if a
SEGV occurs.

I use 2.2.14-SMP.

[EMAIL PROTECTED]


Noam Koren <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> Hi,
>
> I wrote a signal handler that uses the SA_SIGINFO flag and was installed
> using the sa_sigaction parameter. I did this in order to make use of the
> siginfo_t which should be passed to the handler (see: man sigaction).
> However, when the handler is invoked (after a kill(pid,SIGUSR1) in a
> child process), only the si_signo is filled correctly in the siginfo_t
> struct (si_uid and si_pid are 0).
>
> Any ideas?
>
> The handler begins like this:
> void handler(int signo, siginfo_t * siginfo,ucontext * uc){
> int a;
> pid_t b;
> uid_t c;
>
> a=siginfo->si_signo;
> b=siginfo->si_pid;   // this always returns 0
> c=siginfo->si_uid;   // this always returns 0 (yes, even when I am not
> root...)
> ...
> ...
>
> }
>
> Thanks in advance,
> Noam
>



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

From: Mathias Waack <[EMAIL PROTECTED]>
Subject: Re: Timeout function
Date: 02 Aug 2000 11:33:03 +0200

"Ram�n Ag�ero" <[EMAIL PROTECTED]> writes:
>     I need to know if there is a function within Linux kernel that
> allows to execute a function after a specified length of time.

Yes. For a very short amount of time you can use a busy loop: 

                wait_j = jiffies + desired_delay_in_jiffies;
                while (jiffies < wait_j)
                  schedule();  // or noop, depending on your delay
              

For a longer delay use udelay(unsigned usecs) from linux/delay.h. 
Another way could be to sleep on a wait_queue. 

Mathias

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

From: Rafael =?iso-8859-1?Q?Garc=EDa?= <[EMAIL PROTECTED]>
Subject: linux device drivers info
Date: Wed, 02 Aug 2000 13:03:44 +0200

Hi,

There are anything as good as the book 'Linux Device Drivers' by
Alessandro Rubini in a non printed format?

Thanks,

__RAFA__


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

From: Thomas Dickey <[EMAIL PROTECTED]>
Subject: Re: Ncurses version check
Date: 2 Aug 2000 12:48:01 GMT

Marco van de Voort <[EMAIL PROTECTED]> wrote:

> It seems that ncurses 3 defines a different function for that than later
> versions.

before ncurses 5, only the header files tell you the version - there is
no function.

-- 
Thomas E. Dickey <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
http://dickey.his.com
ftp://dickey.his.com

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

From: [EMAIL PROTECTED] (Marco van de Voort)
Subject: Re: Ncurses version check
Date: 2 Aug 2000 12:51:13 GMT

In article <8m95a1$4r6$[EMAIL PROTECTED]>, Thomas Dickey wrote:
>Marco van de Voort <[EMAIL PROTECTED]> wrote:
>
>> It seems that ncurses 3 defines a different function for that than later
>> versions.
>
>before ncurses 5, only the header files tell you the version - there is
>no function.

The header files don't exist. I'm creating the header files :-)

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

From: root <[EMAIL PROTECTED]>
Subject: Re: problem with open files
Date: 2 Aug 2000 13:45:52 GMT

Shankar <[EMAIL PROTECTED]> wrote:


> Hi

>   >Close or compress your files so you aren't using 64GB on 70GB disk?

>       But how do I close deleted files. I have tried gleaning their fds and 
>  then writing separate code to shut them down/unlink them but it doesn't 
>  seem to work.

> shankar

Attach the process to the debugger and close the files from there:

gdb processid

(gdb) call close(1234)

Hope this helps

[EMAIL PROTECTED]


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

From: Mathias Waack <[EMAIL PROTECTED]>
Subject: Re: Timeout function
Date: 02 Aug 2000 15:41:54 +0200

Mathias Waack <[EMAIL PROTECTED]> writes:
> Yes. For a very short amount of time you can use a busy loop:
> 
>                 wait_j = jiffies + desired_delay_in_jiffies;
>                 while (jiffies < wait_j)
>                   schedule(); // or noop, depending on your delay

As I've just learned its wrong. To avoid problems because of a 
possible jiffies wrap, you should better use

    #include <linux/timer.h>
    wait_j = jiffies + desired_delay_in_jiffies;
    while ( time_before(jiffies,wait_j) )
      schedule();  // or noop, depending on your delay
 
I hope its now correct. Thanks Jonathan.

Mathias

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

From: Gee <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps
Subject: socket connection, please help!!
Date: Wed, 02 Aug 2000 10:53:50 -0400

Hi, I'm developing software on the linux machine that requires network
connections using sockets. the connection is between redhat 6.2 on x86
and solaris on a sparc

the problem I'm having is the sockets doesn't connect, the server doesnt
even see the request to connect.

I'm wondering if anyone can shine some light onto this.

thanks
Gee


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

From: [EMAIL PROTECTED]
Subject: Are there any timerLib available
Date: Wed, 02 Aug 2000 15:06:43 GMT

Hi,

I am looking for timeLib for linux basically looking at function that
windows provide like SetTimer, or vxworks posix timer_connect or
timer_create etc. Also event based calls like CreateEvent etc.

Thank you for your time,

Rav


Sent via Deja.com http://www.deja.com/
Before you buy.

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

From: jac0b <[EMAIL PROTECTED]>
Subject: Multiple System.map symlinks?
Date: Wed, 02 Aug 2000 11:46:17 -0400

Hello,
        I'm compiling different versions of the linux kerenl. What I would like
to do is be able to have multiple Systam.map-x.y.z 's. This way when I
boot into a different versions of the kernel it wont complain about the
System.map-x.y.z being the worng version. Here's my system:

Distro: RedHat 6.0
Booter: Lilo

I notice that the map= is a global setting in lilo.conf. I try to
specify it in each image subsection, but lilo complains about that.

Please email me at: [EMAIL PROTECTED] and reply to the group so others
can learn from this.

Thank you,

Alvin Beach

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

From: [EMAIL PROTECTED] (Daniel P. Katz)
Subject: read() and directories
Date: 02 Aug 2000 11:46:06 -0400

Hi.

        I tried to do an octal dump of a directory using GNU od(1) and
got the following response:

$ od -c .
od: .: Is a directory
0000000

Some helpful folks on gnu.utils.bug explained that the problem was
that the Linux kernel (2.2 in my case) "doesn't support read()
operations on directories, only readdir() and friends are supported."
Since od uses read(), it can't dump the directory.

What I'd like to understand is *why* the kernel won't support read()
on directories.  I realize that readdir() etc. should be preferred,
but is there any reason why supporting read() for directories as well
would be a bad thing?

Hope this is the right forum for this question, and sorry if it's an
FAQ.  

Thanx.

Dan

P.S.  Is there a simple way to dump a directory with existing common
tools, or do I need to hack od to use readdir() or some such thing?


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

From: Fro-Man <[EMAIL PROTECTED]>
Subject: Re: read() and directories
Date: Wed, 2 Aug 2000 12:12:06 -0400

On 2 Aug 2000, Daniel P. Katz wrote:

> Hi.
> 
>         I tried to do an octal dump of a directory using GNU od(1) and
> got the following response:
> 
> $ od -c .
> od: .: Is a directory
> 0000000
> 
> Some helpful folks on gnu.utils.bug explained that the problem was
> that the Linux kernel (2.2 in my case) "doesn't support read()
> operations on directories, only readdir() and friends are supported."
> Since od uses read(), it can't dump the directory.
> 
> What I'd like to understand is *why* the kernel won't support read()
> on directories.  I realize that readdir() etc. should be preferred,
> but is there any reason why supporting read() for directories as well
> would be a bad thing?
> 
> Hope this is the right forum for this question, and sorry if it's an
> FAQ.  
> 
> Thanx.
> 
> Dan
> 
> P.S.  Is there a simple way to dump a directory with existing common
> tools, or do I need to hack od to use readdir() or some such thing?

>From what I remember this is true and correct behavoir.  Directories are
kind of special in that if you screw them up, you could lose whole
portions of your file structure, so neither read(), nor write() will work
on them.

I think the best idea would be to hack the source of od.  However keep in
mind, readdir is not going to just dump the directory file, it is going to
read it how it is supposed to, and only return the files inthe directory.
So really there is no net gain.

Aaron Day                         /   Keep the milk  in   /
[EMAIL PROTECTED]                /    the cow, if you    /
http://www.csis.gvsu.edu/~daya    / don't want it to sour /



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

From: [EMAIL PROTECTED] (Pete Zaitcev)
Subject: Re: read() and directories
Date: Wed, 02 Aug 2000 16:34:45 GMT

> What I'd like to understand is *why* the kernel won't support read()
> on directories.  I realize that readdir() etc. should be preferred,
> but is there any reason why supporting read() for directories as well
> would be a bad thing?

If we allow directories to be read, new programmers start reading
them and before you can blink three times the marketplace is
full of programs that cannot work on anything but ext2.
Can we say "NFS"?

If you want to look at the physical layout of a particular
filesystem you should read off the media.

--Pete

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

From: "davidz" <[EMAIL PROTECTED]>
Subject: Memory Display command
Date: Wed, 2 Aug 2000 18:05:58 +0200

Does any body now about command that can  display the data that exist in my
memory ? (for instance which data
reside in address 0 till 0x 10000)

Bye

David





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

From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: Are there any timerLib available
Reply-To: [EMAIL PROTECTED]
Date: Wed, 02 Aug 2000 16:33:41 GMT

On Wed, 02 Aug 2000 15:06:43 GMT, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
wrote:
>Hi,
>
>I am looking for timeLib for linux basically looking at function that
>windows provide like SetTimer, or vxworks posix timer_connect or
>timer_create etc. Also event based calls like CreateEvent etc.

timer_create is in the glibc 2.2 beta. 

Win32 events are braindamaged, especially manual reset ones; you should
consider rewriting the code to use condition variables or semaphores.

Win32 was designed by people who did not understand multithreading very well.
That is why it does not implement condition variables, but instead 
gives you race condition inducers like PulseEvent.

-- 
Any hyperlinks appearing in this article were inserted by the unscrupulous
operators of a Usenet-to-web gateway, without obtaining the proper permission
of the author, who does not endorse any of the linked-to products or services.

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


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

Reply via email to