Linux-Development-Sys Digest #58, Volume #7 Mon, 16 Aug 99 20:14:22 EDT
Contents:
Re: fork() question (Emsi)
Re: Slackware and glibc2 (Emsi)
Q: want to keep eth0 as eth0... really. (joh jae chul)
Re: undefined reference ("Stefan Monnier "
<[EMAIL PROTECTED]>)
Re: buffer and page caches (Robert John Minerick)
Re: dynamic IP address (Johan Kullstam)
Re: 9600bps quicker than expected (Peter Pointner)
Re: fork() question (Stephan Krings)
undefined reference (Robert Kerr)
Re: "top" command's source code! (Justin Tripp)
Re: Accessing user space memory in kernel mode. ([EMAIL PROTECTED])
Re: Angekommen? (Juergen Heinzl)
Re: What is loff_t? (Juergen Heinzl)
Re: reading kernel symbols (Andi Kleen)
Re: What is loff_t? (Kaz Kylheku)
Re: Problem with device driver. HELP (Peter Pointner)
Re: Deadly optimization bug (all versions!) (James Yang)
USITS '99--Symposium on Internet Technologies, Pre-Reg Deadline: September 17 (Moun
Chau)
Re: big-endian Linux on Alpha? (Georg Acher)
procps-2.0.2 is indeed broken! ([EMAIL PROTECTED])
mmap() still causing problems (Grant Edwards)
----------------------------------------------------------------------------
From: Emsi <[EMAIL PROTECTED]>
Subject: Re: fork() question
Date: Mon, 16 Aug 1999 18:57:41 +0200
Reply-To: Emsi <[EMAIL PROTECTED]>
On Mon, 16 Aug 1999, Rob 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
> pointing to allocated memory prior to the fork process, can a child
> access this memory as well ?
> Does the above code work then ? I mean the params passed to the
> function are those valid ?
>
Everything is coopied. .text segment is the same, all others are copied o
maped to oryginal one.
--
[EMAIL PROTECTED]
http://it.pl/emsi
nawet nie mysl o tym ze moglbys przechytrzyc los wbijajac sobie
w serce kilkucentymetrowy kolec z zimnego metalu
------------------------------
From: Emsi <[EMAIL PROTECTED]>
Subject: Re: Slackware and glibc2
Date: Mon, 16 Aug 1999 18:59:47 +0200
Reply-To: Emsi <[EMAIL PROTECTED]>
On Mon, 16 Aug 1999, Jamie Anderson wrote:
> Hello all,
> I am having a problem getting a Slackware 4.0
> distribution to use glibc2 as the default C library. I
> followed the steps in the glibc2-HOWTO, including
> downloading and compiling glibc-2.1. I also changed the
> gcc sym link to point to egcs. Now when I try to compile
> even a simple hello world program, ld reports that it could
> not find crt1.o, although I am quite sure that the
> directory I moved it to is in ld.so.conf, and I have run
> ldconfig -v. If anyone could offer any pointers, I would
> be most grateful. Thank you,
>
Look in slackware contrib. Patric Volkerding have providen a short
information of installing glibc2 runtime library and glibc2 to compile
with and so on...
--
[EMAIL PROTECTED]
http://it.pl/emsi
nawet nie mysl o tym ze moglbys przechytrzyc los wbijajac sobie
w serce kilkucentymetrowy kolec z zimnego metalu
------------------------------
From: joh jae chul <[EMAIL PROTECTED]>
Subject: Q: want to keep eth0 as eth0... really.
Date: Mon, 16 Aug 1999 12:02:07 -0500
Hi, all.
I have 3c905b ethernet card on board. When I installed additional 3c905b
card on pci slots, the on board became eth1. I'd like to keep on board
one as eth0.
My temporary solution for that was to modify device driver (3c59x.c)
assuming that <pci_bus, pci_device_fn> pair is unique on a machine.
I pcibios_find_class() and save pci_bus and pci_device_fn values in
arrays. And then, do the rest of the stuff ( request_irq, memory
allocation, etc ) while "making sure that this is done for the on board
card first".
But, how do I know which <pci_bus, pci_devie_fn> pair stands for the on
board card? I tested on 2 machines, they seem that pci_bus = 0x00,
pci_device_fn = 0x88 are for on board card. But, is it *always* so? Or,
is there other ways? For example, is there a flag that stands for "on
board" card?
I have 40 more machines forming a cluster, and I'd like to make sure it's
okey before working on the cluster.
Thanks in advance.
------------------------------
From: "Stefan Monnier <[EMAIL PROTECTED]>"
<[EMAIL PROTECTED]>
Subject: Re: undefined reference
Date: 16 Aug 1999 15:36:35 -0400
>>>>> "Robert" == Robert Kerr <[EMAIL PROTECTED]> writes:
> /home/bob/lib/linux/libkernel.a(swsplsur.o): In function
> `sweep_spl_sur::deep_copy(pointer_map *) const':
> swsplsur.o(.text+0x537): undefined reference to `__eh_pc'
> swsplsur.o(.text+0x56a): undefined reference to `__eh_pc'
I don't know exactly how to solve your problem, but I'm pretty sure that
PC stands for `Program Counter' and that EH stands for `Exception Handler',
so it is internal data (hence the double underscore) that should have
been generated. Maybe you're mixing code compiled with different C
compilers (or different versions of the same compiler or with the
same compiler but with different flags, ...).
Stefan
------------------------------
From: [EMAIL PROTECTED] (Robert John Minerick)
Subject: Re: buffer and page caches
Date: 16 Aug 1999 20:17:05 GMT
I see. My understanding is that every block device uses buffers to read
data. So, when data is read, does it first get placed into buffers and
then copied into the page cache? Or is the buffer cache never even used on
a read? 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.
------------------------------
From: Johan Kullstam <[EMAIL PROTECTED]>
Subject: Re: dynamic IP address
Date: 16 Aug 1999 12:52:21 -0400
[EMAIL PROTECTED] (David T. Blake) writes:
> michael.t.kretsch.1 <[EMAIL PROTECTED]> wrote:
> > I just moved to L.A. and recieved a direct connection from
> > mediaone and they would not give me a static IP address. So I am
> > not sure how to set up the connection under linux. If linux does
> > not support dynamic IP addresses then is there any way that I can
> > take an empty address from mediaone.
>
> What do you need a static IP address for ?
>
> I only found a difference for MTAs, and it is kind of a
> joke to run one from a dynamic IP anyway.
exactly. you can have your own smtp port for incomming mail if you
have a static ip. (outgoing mail has never been that much of a
problem.) but also things like webpages, ftp service &c are more
nicely done with static ip addresses.
--
johan kullstam
------------------------------
From: Peter Pointner <[EMAIL PROTECTED]>
Subject: Re: 9600bps quicker than expected
Date: Mon, 16 Aug 1999 21:36:36 GMT
Sebastien <[EMAIL PROTECTED]> wrote:
[snip]
> The duration of one pulse (bit) should be equal to 1/(Baud_base).
[snip]
No. The baud_base parameter tells setserial the clock input frequency
to the UART chip (this frequency is actually 16 times the baud_base).
If the divider in the UART is set to 1, you get a baud rate equal to
the baud_base.
If you don't have special hardware, there is no need to change
baud_base. If you specify a baud_base that does not match the hardware,
you won't get the baud rate you specify. E. g., if you specify a
baud_base of 57600 (instead of standard 115200), and you set the baud
rate to 9600, the driver will set the divider to 6 (instead of 12),
and your actual baud rate will be 19200 (= 115200 / 6).
One more thing: I saw your posting also on c.o.l.d.apps. If you _really_
think you should post to more than one group, then _please_ do crosspost,
and not multipost. And you should set follow-up then, but I'm afraid
that half of the readers don't even know what that is ...
Peter
------------------------------
From: Stephan Krings <[EMAIL PROTECTED]>
Subject: Re: fork() question
Date: 16 Aug 1999 23:23:47 +0200
Hello,
"Rob" <[EMAIL PROTECTED] (X=y)> writes:
> Now, my question is, what exactly is copied from the parent to the
> child process?
Quite a lot is copied for the child process. It's much easier to list
the things, that don't get copied. So here from the excellent libc-manual:
===========================================================================
The specific attributes of the child process that differ from the
parent process are:
* The child process has its own unique process ID.
* The parent process ID of the child process is the process ID of its
parent process.
* The child process gets its own copies of the parent process's open
file descriptors. Subsequently changing attributes of the file
descriptors in the parent process won't affect the file
descriptors in the child, and vice versa. *Note Control
Operations::. However, the file position associated with each
descriptor is shared by both processes; *note File Position::..
* The elapsed processor times for the child process are set to zero;
see *Note Processor Time::.
* The child doesn't inherit file locks set by the parent process.
*Note Control Operations::.
* The child doesn't inherit alarms set by the parent process. *Note
Setting an Alarm::.
* The set of pending signals (*note Delivery of Signal::.) for the
child process is cleared. (The child process inherits its mask of
blocked signals and signal actions from the parent process.)
===========================================================================
Regards,
Stephan
------------------------------
From: Robert Kerr <[EMAIL PROTECTED]>
Subject: undefined reference
Date: Sat, 14 Aug 1999 16:54:21 -0600
Hi all,
I'm almost all the way done porting a large software project to Linux.
Everything compiles beautifully etc, but I get a linking error. I'm not
complaining, I used to get over 1000 lines of linking errors, now I just
get the one. But I'm having a heck of a time understanding it. This is
the error:
/home/bob/lib/linux/libkernel.a(swsplsur.o): In function
`sweep_spl_sur::deep_copy(pointer_map *) const':
swsplsur.o(.text+0x537): undefined reference to `__eh_pc'
swsplsur.o(.text+0x56a): undefined reference to `__eh_pc'
What is __eh_pc? and why can I not find it in any of the standard libs?
It's not defined in any of my libs either.
Any ideas?
Thanks
--
-bob
An optimist says the glass is half full, a pessimist says the glass
is half-empty. An engineer says the glass is twice as big as it
needs to be.
**********************************************************************
* Robert Kerr, The morphing guy. * 368 Clyde Building, BYU *
* [EMAIL PROTECTED] * Provo, Utah 84602 *
* [EMAIL PROTECTED] * Phone: (801) 378-2029 *
* http://www.et.byu.edu/~kerrr * Fax: (801) 378-4449 *
**********************************************************************
------------------------------
From: Justin Tripp <[EMAIL PROTECTED]>
Subject: Re: "top" command's source code!
Date: 16 Aug 1999 01:11:41 GMT
The latest and greatest orignal source can atleast be found at
ftp://ftp.groupsys.com/pub/top/
This version may or may not compile because it supports many systems and
they keep changing. It should be not too far off the mark of the version of
top that is distributed with your os. It is the original top from the original
author. For other modified versions look to your OS distributor.
The web page can be found at:
http://www.groupsys.com/topinfo/
.justin.
Kaz Kylheku <[EMAIL PROTECTED]> wrote:
: On Sun, 15 Aug 1999 23:22:40 +0800, lming <[EMAIL PROTECTED]> wrote:
:>Hi...
:>
:>Does somebody could tell me where the top command's source code is ??
: I believe that it's part of a package called ``psutils''. Search for that.
--
========================================================================
Justin Leonard Tripp [EMAIL PROTECTED]
Configurable Computing Laboratory Research Assistant CB 461 x8-7206
Electrical and Computer Engineering Department Brigham Young University
------------------------------
From: [EMAIL PROTECTED]
Subject: Re: Accessing user space memory in kernel mode.
Date: 16 Aug 1999 22:19:52 GMT
[EMAIL PROTECTED] wrote:
: How do i access the file system in from device driver?
Asking this question may indicate that there
is something wrong with your design for the
device driver. Almost all (all?) device drivers get
along without accessing the filesystem. Normally
they are configured at start up by user programs
(eg. /sbin/ifconfig). Then you can make running
changes to the device driver configuration, again
using the same user programs. Usually a device
driver doesn't need to `save state' at shut down -
it is simply configured again at next boot, or you
can think of it as the configuration `state' being
stored in the start up script.
For more complex stuff, it may be better to communicate
with a daemon which deals with any necessary file
system interaction. A good example of this would
be the card manager daemon which manages some
complex events when PCMCIA cards are inserted
and removed. Or one could point to the old kerneld
daemon which automatically loaded or unloaded kernel
modules from the filesystem on behalf of the kernel.
Of course, I may be very wrong here, and you
may have a very good reason for wanting to access
the filesystem ... in which case post here and
tell us what you're up to.
Rich.
--
[EMAIL PROTECTED] | Free email for life at: http://www.postmaster.co.uk/
BiblioTech Ltd, Unit 2 Piper Centre, 50 Carnwath Road, London, SW6 3EG.
+44 171 384 6917 | Click here to play XRacer: http://xracer.annexia.org/
--- Original message content Copyright � 1999 Richard Jones ---
------------------------------
From: [EMAIL PROTECTED] (Juergen Heinzl)
Subject: Re: Angekommen?
Date: Mon, 16 Aug 1999 21:54:30 GMT
In article <7p9a06$324$[EMAIL PROTECTED]>, Michael Fuchs wrote:
>Hi - Nachricht angekommen?
... this is what test groups are all about chap ...
------------------------------
From: [EMAIL PROTECTED] (Juergen Heinzl)
Subject: Re: What is loff_t?
Date: Mon, 16 Aug 1999 21:54:32 GMT
In article <[EMAIL PROTECTED]>, Mark Hamstra wrote:
>[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.
No, ssize_t means signed size_t. E.g. read() / write() returns
ssize_t, say a signed type that is large enough to hold the result.
On some 32 bit machines one can compile with 64 bit files support
and then sizeof(ssize_t) != sizeof(int) might become true (there
are no explicit long versions of size_t and ssize_t). It must
be signed though to be able to flag an error.
Gee, am I a smart guy, eh 8))
Juergen
--
\ Real name : J�rgen Heinzl \ no flames /
\ EMail Private : [EMAIL PROTECTED] \ send money instead /
------------------------------
From: Andi Kleen <[EMAIL PROTECTED]>
Subject: Re: reading kernel symbols
Date: 16 Aug 1999 18:10:13 +0200
Robin Becker <[EMAIL PROTECTED]> writes:
> 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.
klogd reads the symbols first, then outputs the kernel messages from
the buffer. If it did it the other way round it wouldn't e.g. be able
to decode oopses that occurred during the boot.
If you don't believe me you are free to look at the source code...
-Andi
--
This is like TV. I don't like TV.
------------------------------
From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: What is loff_t?
Date: Mon, 16 Aug 1999 19:01:44 GMT
On Mon, 16 Aug 1999 14:02:44 GMT, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>What is the type loff_t used for?
See the llseek (sic) man page.
------------------------------
From: Peter Pointner <[EMAIL PROTECTED]>
Subject: Re: Problem with device driver. HELP
Date: Mon, 16 Aug 1999 21:49:45 GMT
[EMAIL PROTECTED] wrote:
> When i try to compile this charter device driver i get this error:
> pbus.c: In function `pb_open':
> pbus.c:70: wrong type argument to bit-complement
> Here is the code:
> while((lock[dev] >> func) & 1) {
> interruptible_sleep_on(&pb_WaitQ);
> line 70-> if(current->signal & ~current->blocked) {
> MOD_DEC_USE_COUNT;
> return -EINTR;
> }
> }
> What is wrong?
You are using a 2.2.x kernel? Then use
if (signal_pending(current))
instead of your code. AFAIK current->blocked has been changed
to an array to make more than 32 signals possible, and ~ can't
be used on that.
Peter
------------------------------
From: jamesy@ottoman. (James Yang)
Crossposted-To: gnu.gcc.help,gnu.gcc.bugs
Subject: Re: Deadly optimization bug (all versions!)
Date: Mon, 16 Aug 1999 23:21:58 GMT
Interesting enough, -O3 on x86 with egcs 1.1.2 and gcc 2.7.2.3 generate
the proper code. But I do duplicate your results on both with -O and -O2.
On 16 Aug 1999 11:24:11 GMT, Veksler Michael <[EMAIL PROTECTED]> wrote:
>
>
>The bug shows itself on gcc-2.7.2.1, egcs-1.0.1, egcs-1.1.2, gcc-2.95.
>On AIX-4.1, Linux-x86 (RH4.2 and RH6.0).
>
>Just try to compile the following code once with -O and once without.
>This may be the reason behind some of the problems with Linux-2.2.xx
>
>(I post this here, instead of gnu.gcc.bugs, since my previous
>posts did not reach the group).
>
>The code:
>
>---------- 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 );
>}
>
>int main()
>{
> printf("ret=%d\n", test(1,0)); /* should print 0 */
> printf("ret=%d\n", test(1,1)); /* should print 1 */
> printf("ret=%d\n", test(1,65535)); /* should print 1 */
>
> return 0;
>}
>
>
------------------------------
Crossposted-To:
comp.infosystems.www.users,comp.lang.java,comp.org.eff,comp.os.linux.admin,comp.os.linux.misc,comp.security,comp.security.unix,comp.sys.sgi.admin,comp.sys.sun.admin,comp.unix.admin,ieee.admin
From: [EMAIL PROTECTED] (Moun Chau)
Subject: USITS '99--Symposium on Internet Technologies, Pre-Reg Deadline: September 17
Date: Mon, 16 Aug 1999 23:01:54 GMT
Are you involved in the support or development of Internet technologies and
systems?
Are you eager to improve Internet/Web performance and security?
Get Together with fellow Internet developers and Web site managers to learn
from actual experience and reports of the latest research and technologies.
USITS '99
2ND USENIX SYMPOSIUM ON INTERNET TECHNOLOGIES AND SYSTEMS
October 11-14, 1999
Boulder, Colorado, USA
Sponsored by USENIX, the Advanced Computing Systems Association
Co-sponsored by the IEEE Computer Society Technical Committee on Internet
===============================================================
SAVE--Register by September 17, 1999.
Program and Online Registration: www.usenix.org/events/usits99
===============================================================
TUTORIALS -- to Put You in Command of Internet Technologies
*Web Application Security
*XML and Metadata for the Web
*Intrusion Detection and Network Forensics
*Introduction to Virtual Private Networks
KEYNOTE ADDRESS -- E-Commerce-An Optimistic View, Udi Manber, Yahoo! Inc.
REFEREED RESEARCH REPORTS -- the Latest Internet Developments
*Shared Caching
*Applications
*Techniques
*Proxy Implementation
*Prefetching
*Architectures
*Caching Policies
*Server Implementation
*Works-in-Progress Reports
===============================================================
USENIX, the Advanced Computing Systems Association, is the international,
nonprofit society made up of scientists, engineers, and system
administrators working on the cutting edge of systems and software. For 25
years USENIX conferences and workshops have emphasized quality exchange of
technical ideas unfettered by stodginess or commercialism.
------------------------------
From: [EMAIL PROTECTED] (Georg Acher)
Subject: Re: big-endian Linux on Alpha?
Date: 16 Aug 1999 19:22:32 GMT
In article <7p1r07$q4b$[EMAIL PROTECTED]>, Robert Komar <[EMAIL PROTECTED]> writes:
|> [EMAIL PROTECTED] wrote:
|>
|> : Is it possible to run Linux on an Alpha in
|> : big-endian mode? I know the machine has the
|> : capability of changing sex by use of a single
|> : switch, but is it supported by the Linux kernel?
|>
|> Are you sure about being able to do this? I know
|> that some MIPS processors support this, but I had
|> never heard that Alphas could do it. In any case,
|> the people in comp.os.linux.alpha would be the
|> right ones to ask.
It is defined in the Alpha architecture spec, that there may be big endian
support, but I don't know which of the current Alpha CPUs actually implement this
(the EV5 (21164) doesn't have it).
--
Bye
Georg Acher, [EMAIL PROTECTED]
http://www.in.tum.de/~acher/
"Oh no, not again !" The bowl of petunias
------------------------------
From: [EMAIL PROTECTED]
Subject: procps-2.0.2 is indeed broken!
Date: 16 Aug 1999 13:06:43 -0700
The following quickie patch worked for me:
--- procps-2.0.2-orig/proc/sysinfo.c Sat Mar 20 12:38:48 1999
+++ procps-2.0.2/proc/sysinfo.c Mon Aug 16 12:54:08 1999
@@ -30,6 +30,8 @@
static int uptime_fd = -1;
#define LOADAVG_FILE "/proc/loadavg"
static int loadavg_fd = -1;
+#define CPUINFO_FILE "/proc/cpuinfo"
+static int cpuinfo_fd = -1;
#define MEMINFO_FILE "/proc/meminfo"
static int meminfo_fd = -1;
@@ -103,6 +105,17 @@
unsigned long user_j, nice_j, sys_j, other_j; /* jiffies (clock ticks) */
double up_1, up_2, seconds;
unsigned long jiffies, h;
+ unsigned int ncpu = 0;
+ char *p;
+ FILE_TO_BUF(CPUINFO_FILE,cpuinfo_fd);
+ p = buf;
+ do {
+ p = strstr(p, "processor");
+ if (p) {
+ p += 9;
+ ncpu++;
+ }
+ } while (p);
do{
FILE_TO_BUF(UPTIME_FILE,uptime_fd); sscanf(buf, "%lf", &up_1);
/* uptime(&up_1, NULL); */
@@ -111,7 +124,7 @@
FILE_TO_BUF(UPTIME_FILE,uptime_fd); sscanf(buf, "%lf", &up_2);
/* uptime(&up_2, NULL); */
} while((long)( (up_2-up_1)*1000.0/up_1 )); /* want under 0.1% error */
- jiffies = user_j + nice_j + sys_j + other_j;
+ jiffies = (user_j + nice_j + sys_j + other_j) / ncpu;
seconds = (up_1 + up_2) / 2;
h = (unsigned long)( (double)jiffies/seconds );
switch(h){
--
Forte International, P.O. Box 1412, Ridgecrest, CA 93556-1412
Ronald Cole <[EMAIL PROTECTED]> Phone: (760) 499-9142
President, CEO Fax: (760) 499-9152
My PGP fingerprint: 15 6E C7 91 5F AF 17 C4 24 93 CB 6B EB 38 B5 E5
------------------------------
From: grant@nowhere. (Grant Edwards)
Subject: mmap() still causing problems
Date: Mon, 16 Aug 1999 20:08:16 GMT
I'm still trying (unsuccessfully) to allow a user to mmap a 1
page DMA buffer that is allocated using __get_free_page in a
device driver module.
I tried the method mentioned by Rubini in "Linux Device
Drivers" where I impliment a nopage handler in the vm_ops
structure. I couldn't get that to work. Data placed in the
buffer by the driver wasn't showing up when the user program
dereferenced the pointer.
So, I switched to the method used by the sound driver to let
the user mmap its DMA buffer. At module initialization I grab
a page and mark it reserved, allow the user to mmap it, then
unreserve it and free it when the module is unloaded.
It seems to work (the user program sees data written by the
driver), except that after a while the system gets unstable:
kernel Oops when I try to start a new shell, stuff like that.
This just shouldn't be this difficult, but I can't figure out
what I'm doing wrong:
int init_module(void)
{
...
scratchPage = (unsigned char*)__get_free_page(GFP_ATOMIC|GFP_DMA);
set_bit(PG_reserved, &mem_map[MAP_NR(scratchPage)].flags);
...
}
void cleanup_module(void)
{
...
clear_bit(PG_reserved, &mem_map[MAP_NR(scratchPage)].flags);
free_page((unsigned long)scratchPage);
...
}
int scratch_mmap(struct file * file, struct vm_area_struct * vma)
{
unsigned size = vma->vm_end - vma->vm_start;
if (size != PAGE_SIZE)
return -EINVAL;
/* put something in buffer, so we know user program got right page */
*((unsigned*)scratchPage) = virt_to_bus(scratchPage);
if (remap_page_range(vma->vm_start, virt_to_phys(scratchPage),
PAGE_SIZE, vma->vm_page_prot))
return -EAGAIN;
return 0;
}
--
Grant Edwards grante Yow! Hello. Just walk
at along and try NOT to think
visi.com about your INTESTINES being
almost FORTY YARDS LONG!!
------------------------------
** 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
******************************