Linux-Development-Sys Digest #686, Volume #8 Wed, 2 May 01 22:13:11 EDT
Contents:
???how to get bus-address of the PCI hardware device ([EMAIL PROTECTED])
Re: buffer cache ("Karl Heyes")
Re: kernel debugger again and again (sorry) (greg)
Re: Critical sections ("-hs-")
Re: ???how to get bus-address of the PCI hardware device (Grant Edwards)
Re: Cannot load shared object file (Martin)
Transfer data to mySQL Server
Re: Transfer data to mySQL Server ([EMAIL PROTECTED])
Re: Startup service ("Darren")
Re: Shared library related questions ([EMAIL PROTECTED])
Re: md5sum'ing block devices ([EMAIL PROTECTED])
Re: Transfer data to mySQL Server (Dean Thompson)
----------------------------------------------------------------------------
From: [EMAIL PROTECTED]
Subject: ???how to get bus-address of the PCI hardware device
Date: Wed, 02 May 2001 20:29:02 GMT
anyone know how...
------------------------------
From: "Karl Heyes" <[EMAIL PROTECTED]>
Subject: Re: buffer cache
Date: Wed, 02 May 2001 21:51:45 +0100
In article <9cnt3b$7o0$[EMAIL PROTECTED]>, "Zhiyong Xu" <[EMAIL PROTECTED]>
wrote:
> So it means if I want to intercept all disk I/Os, it is not enough to
> monitor all I/Os through buffer cache, but also need to monitor all I/Os
> through page caches.
The question here is why do you want to intercept the I/O, there's no way
from userspace that I know of that lets you intercept the I/O. You either go
through cache or you don't. How the buffer/page cache get used is system
dependant. In 2.2 the writes were going through the buffer cache then kept
in sync with the page cache which proved wasteful.
The raw I/O facility was added for partitions that were not required to hit
the page cache, typically for certain oracle people.
Theres is talk of an O_DIRECT for the open syscall which may involve
bypassing page cache but I don't know the details at the moment.
> For traditional unix system, it seems all disk I/Os must go through buffer
> cache, so that means in kernel 2.4.x, it is quite different compare to
> traditional unix system?
>
unix never defines how the caches get used, only the API for the
applications to do I/O.
As a general rule there isn't many applications that need none cached I/O.
karl.
------------------------------
From: [EMAIL PROTECTED] (greg)
Subject: Re: kernel debugger again and again (sorry)
Date: Wed, 2 May 2001 20:51:35 +0000 (UTC)
On Wed, 02 May 2001 15:03:58 GMT, Massimiliano Caovilla
<[EMAIL PROTECTED]> wrote:
> hello again,
>I'm sorry to bother but I really feel this question.
>I need a way to debug a kernel module wich makes use of kernel threads,
>I have some lock problems wich are very hard to track without (let's
>say) a threadlist or something like solaris adb. I've been pointed to
>chech pice and some kernel debugging patch, but they all don't work /
>result unusable. What is the OFFICIAL linux kernel debugging way? There
>MUST be a way to debug a module!!! I'm opened to all possibilities,
>please just suggest me one. Should I write to Linus directly to get
>hints about this?? I don't want to annoy him!!!!
well, this is not such a good idea. Linus doesn't like the idea of integrating
a kernel debugger within the official kernel releases. See kernel mailing list
archives for details regarding Linus' various reasons :
http://www.mail-archive.com/linux-kernel%40vger.kernel.org/
However you can check on the SGI Linux home page to get wether the embedded
kernel debugger (kdb) or the gdb kernel stub (which you can use in conjunction
with gdb over a serial line or a tcp port). You may find available
informations on this page (kgdb).
kgdb - http://oss.sgi.com/projects/kgdb/
kdb - http://oss.sgi.com/projects/kdb/
hope this is of any help
--
greg
------------------------------
From: "-hs-" <[EMAIL PROTECTED]>
Crossposted-To: comp.lang.c,linux.dev.kernel
Subject: Re: Critical sections
Date: Wed, 2 May 2001 22:52:20 +0200
Dean Wakerley a �crit dans le message <9cona2$fut$[EMAIL PROTECTED]>...
>Whats the standard way in C of enforcing mutual exclusion on a section of
>code? I'm thinking of semaphores and the equivalent of java's synchronised
>keyword, but can't find any info.
The C language doesn't support threads and associated machinery at all. From
the abstract C-machine point of view, those are system features.
--
-hs- "spaces, not tabs" email: emdel at noos.fr
CLC-FAQ: http://www.eskimo.com/~scs/C-faq/top.html
ISO-C Library: http://secure.dinkumware.com/htm_cl/
FAQ de FCLC : http://www.isty-info.uvsq.fr/~rumeau/fclc
------------------------------
From: [EMAIL PROTECTED] (Grant Edwards)
Subject: Re: ???how to get bus-address of the PCI hardware device
Date: Wed, 02 May 2001 21:15:10 GMT
In article <i6_H6.7433$[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote:
>anyone know how...
If we presume that's a question the answer is "yes."
The answer to the question you really meant to ask is:
1) From user-space, use 'lspci -v' or read /proc/pci or
/proc/bus/pci/devices
2) From kernel-space, look at some of the PCI drivers. Donald
Becker's Ethernet drivers are probably good examples to
follow since he's factored out some common PCI stuff that
is used by multiple drivers:
http://www.scyld.com/network/
--
Grant Edwards grante Yow! Why was I BORN?
at
visi.com
------------------------------
From: Martin <martin.o_brien@[no-spam]which.net>
Subject: Re: Cannot load shared object file
Reply-To: martin.o_brien@[no-spam]which.net
Date: Wed, 2 May 2001 23:27:39 +0100
Craig Kelley wrote:
> You probably want to force-install the stdc library:
>
> cd /path/to/source/cd/RPMS
> rpm -i libstdc++*rpm
>
> You may have to tell rpm to '--force' if you have a broken
> setup (ie, if the files were moved without RPM's knowledge);
> any dependencies need to be checked out as well if you get a
> warning.
I have libstdc++2.10 installed and that contains
/usr/lib/libstdc++-3-libc6.2-2-2.10.0.so. I also have
libstdc++2.10-devel and libstdc++-compat installed.
I don't understand why /usr/lib/libstdc++-libc6.1-2.so.3 is a
link-name to an older library file.
Martin
http://homepages.which.net/~martin.o_brien/
------------------------------
From: <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps,comp.os.linux.networking
Subject: Transfer data to mySQL Server
Date: Thu, 3 May 2001 00:43:01 +0200
Hi,
what possibilities exist to transfer few data to a mySQL Database running on
a Linux Red Hat Server 7.0? Have I to implement my own server program in C++
or any other programming language or are there any less complicated solution
for this kind of problem?
Thanks a lot in advance
------------------------------
From: [EMAIL PROTECTED]
Subject: Re: Transfer data to mySQL Server
Crossposted-To: comp.os.linux.development.apps,comp.database
Date: Wed, 02 May 2001 23:19:16 GMT
<[EMAIL PROTECTED]> writes:
> what possibilities exist to transfer few data to a mySQL Database
> running on a Linux Red Hat Server 7.0? Have I to implement my own
> server program in C++ or any other programming language or are there
> any less complicated solution for this kind of problem?
First comment: This question does not need to have _anything_ to do
with Red Hat, or, for that matter, Linux. MySQL runs as happily atop
all sorts of Linux "user spaces," as well as various BSDs and Unixes,
so that answers need have _nothing_ to do with anything systematically
oriented towards Linux.
As a result, I've directed followups to comp.database, likely a more
appropriate destination.
You've got a wide variety of options, as MySQL provides bindings to
quite a number of languages. It is accessible from C, C++, as well as
just about any scripting language, as they can inherit APIs from C.
If you've got a one time transfer of data into a MySQL database, then
you could use just about any tool that would transform that data into
a set of SQL "INSERT" statements.
If I had a small set of such data, I might very well pull it into Gnu
Emacs, switch on "macro recording," transform one line into an INSERT
statement, and then take the resulting macro and run it on the rest of
the lines.
I did this once to load about 40,000 stock prices into a PostgreSQL
database. It was slow enough that I regretted _not_ writing a program
to parse the text file.
The next simplest choice would be to write a script in some language
like Perl, Python, REXX, or Lisp that would take the input file and
produce a whole bunch of INSERT statements.
More sophisticated would be to write a script in a scripting language
that supports direct interfacing to MySQL. Perl and Python are both
good examples of this; you can open a connection to the database, and
then pump in INSERTs.
The _LAST_ choice I'd suggest would be to write a program in C/C++.
It's certainly feasible, and is likely able to be faster than any of
the others. But if it's a one shot operation, the extra time spent
developing it is not likely to be worthwhile. And the "faster" part
may turn out to be statistical noise. If it takes an extra 8 hours to
develop something that drops a one time data load from 25 minutes to
20 minutes, that seems to me to likely be a sheer _waste_ of 7 hours
and 55 minutes.
If your data is coming in as xBase data, I believe that there is a
utility specially written to help load that sort of thing into MySQL.
--
(concatenate 'string "cbbrowne" "@acm.org")
http://vip.hex.net/~cbbrowne/resume.html
"I develop for Linux for a living, I used to develop for DOS. Going
from DOS to Linux is like trading a glider for an F117."
-- <[EMAIL PROTECTED]> Lawrence Foard
------------------------------
From: "Darren" <[EMAIL PROTECTED]>
Subject: Re: Startup service
Date: Thu, 3 May 2001 01:40:00 +0100
Xiaomu Zeng <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
>
>
> "D. Stimits" wrote:
>
> > >
> > > aha so it is rc.local i am looking for?
> >
> > If your only concern is to run some command at startup, yes. If it must
> > be controlled for start and stop activity at various runlevels, you'd
> > create a script to go in the init.d subdirectory; then links from the
> > various runlevel directories would determine whether the script is
> > called with a start or stop at the given runlevels. inetd is a sample of
> > something controlled at various runlevels, as well as a few other
> > daemons. To see a list of what is controlled to start or stop, try this:
> > chkconfig --list
> > (chkconfig might not be available under all distributions, I haven't
> > checked)
> >
>
> So rc.local will always be ran, at any init level (even single user mode)?
>
> Xiaomu
cool
>
------------------------------
From: [EMAIL PROTECTED]
Subject: Re: Shared library related questions
Date: 3 May 2001 00:48:58 GMT
On Sun, 29 Apr 2001 19:42:03 -0400 Timur Aydin <[EMAIL PROTECTED]> wrote:
| 1. Under win32, whenever a DLL is loaded into memory by a separate process,
| the system will use the same code segment for each instance, but the data
| segment will be separate for each instance. In order to share memory
| between the DLL's, some work needs to be done. How are things with shared
| libraries under linux? If two processes use the same library (either
| through dl_open or through the gcc -shared switch), will they have separate
| data segments or not?
Libraries are loaded via dlopen() which uses mmap() to actually get the
file contents into memory. The mmap() function can works a number of
different ways, but for the purpose of a library, the memory is set up
so that if any changes are made by any process, that process keeps a
private copy of the change so that other processes that mapped the same
file (loaded the same library) see no change. This is called copy-on-write
and often referred to as "CoW".
When library relocation and linkage takes place, a few pages do get modified
to store pointers for a specific process. Most pages usuaully do not. So
most pages continue to be shared in RAM, if they get loaded. And memory
mapping only actually loads a page from disk to RAM if referenced. And the
pages can get "swapped out". If the page was not modified, "swap out" is
just stealing the RAM for other purposes since it can be swapped back in
right from the original file any time. If the page was modified, and thus
has a copy due to CoW, that copy does get written out to swap space, if the
RAM is needed for other things.
| 2. Under win32, whenever a DLL is loaded and the DLL has a function called
| DllMain, it will be called with a parameter that contains
| DLL_PROCESS_ATTACH. Whenever the DLL is unloaded, the same DllMain will be
| called with a parameter that contains DLL_PROCESS_DETACH. Now I know that
| for linux, the _init and _fini functions can be used for the same purpose,
| but if possible, I want to find a solution that is source code compatible
| for both win32 and linux. Would the solution below work? If yes, what are
| the limitations or difference in behavior compared to the above mentioned
| methods (DllMain, _init, _fini).
They are fairly close. Keep in mind that some of the concepts in Win32 do
not apply to Linux (or Unix). Win32 creates new processes associated with
most DLLs, and these processes are often just maintenance or other things.
This generally exists because Win32 does not have a really tight model of
keeping processes apart from each other. Win32 has a lot of mechanisms for
processes to share things. Linux/Unix does not have as many (but the ones
it does have do quite a lot in the abstract).
In Win32 a DLL can be a daemon, exchanging data between processes, and keeping
the state for sharing this data. In Linux/Unix, this is done using a normal
executable program, which can also be a script such as Perl or Python, or even
a Java class. In Win32, the DLL provides the interface methods to that daemon.
In Linux/Unix, the communication is usually done via an internal socket or
specifically shared memory (arranged separately from a library itself). This
model in Linux/Unix allows separate instances of a daemon for each different
user, so users can run their own. Win32 is weak in this area due to its one
user legacy.
| It is expected that object a's constructor will be called when the library
| loads for the first time and that the destructor will be called when the
| library unloads. And the source can be used on both win32 and linux without
| any modification.
In Linux, a library is treated as an addendum to a process virtual memory
space. You can do this with almost any data file, or block device such as
a disk drive, too (in 32 bit systems, size limitations pose problems, since
a pointer with 32 bits certainly can't pinpoint more than 4GB of space).
Initialization of a library, if implemented, is relevant only to the copy
of the library in that process. If _init causes any changes, the changes
are (through CoW) seen only in the one process involved. Each process that
loads the library would be calling _init in its own context. So if you have
a program that forks 4 child processes, and each of those child processes
load a library which has an _init() function that prints out "Hello world"
then you will see "Hello world" printed out 4 times.
There is no magic for taking some code and simply changing certain calls to
certain functions into calls to others. It all depends on what the caller
is expecting out of the call. One program may have to have things set up
differently than another. You have to not only know how the library calls
behave in the library of interest (and the affect under the system model
that is involved), but you also have to understand you program.
One consideration is that in Win32, access to certain things can be limited
to a specific DLL. In Linux, since the library is just added on to the same
process, access is limited based on the permissions the process has (usually
based on effective and/or real user and/or group, but sometimes some other
flags).
--
=================================================================
| Phil Howard - KA9WGN | Dallas | http://linuxhomepage.com/ |
| [EMAIL PROTECTED] | Texas, USA | http://phil.ipal.org/ |
=================================================================
------------------------------
From: [EMAIL PROTECTED]
Subject: Re: md5sum'ing block devices
Date: 3 May 2001 00:53:52 GMT
On Tue, 1 May 2001 07:52:49 +0100 Loris Caren <[EMAIL PROTECTED]> wrote:
| Thanks very much to Nick and Kasper. Armed with their suggestions I think
| I've found a recipe that works:-
|
| 1. mount the CD
| 2. do a df and note the number of 1k blocks consumed
| 3. umount the CD
| 4. dd if=/dev/cdrom bs=1k count=n | md5sum (where n is from step 2).
|
| This works on all the pressed CDs and home grown CDRs that I've tried on
| all the drives I've got. So it looks as if I can now offer a CDR
| validation service to my WinDoze collegues who have been reliant on just
| looking at the directory structure.
|
| However, I'm still baffled how reading beyond the end of the data can work
| perfectly on one drive but not on another, same kernel, same driver (both
| SCSI).
Apparently devices do vary in how they handle sectors and tracks beyond
the actually recorded data. Recording actually puts some extra padding
in there. That's needed if another session is to be recorded. And for
some reasons it's needed even if not.
I've noted a wide difference of behaviour between IDE and SCSI. I have
3 IDE CDROM drives and 2 SCSI CDROM drives. I get consistent results
with the SCSI ones, but wild and crazy results from the IDE ones.
--
=================================================================
| Phil Howard - KA9WGN | Dallas | http://linuxhomepage.com/ |
| [EMAIL PROTECTED] | Texas, USA | http://phil.ipal.org/ |
=================================================================
------------------------------
From: Dean Thompson <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps,comp.os.linux.networking
Subject: Re: Transfer data to mySQL Server
Date: Thu, 03 May 2001 11:59:03 +1000
Hi!,
> what possibilities exist to transfer few data to a mySQL Database running
> on a Linux Red Hat Server 7.0? Have I to implement my own server program in
> C++ or any other programming language or are there any less complicated
> solution for this kind of problem?
Depending on the SQL language that MySQL is using, you should be able to use
some standard SQL queries to import text via a properly formatted txt file. I
think from memory, the INSERT sql command can take a file, although it has
been awhile since I have used SQL.
See ya
Dean Thompson
--
+____________________________+____________________________________________+
| Dean Thompson | E-mail - [EMAIL PROTECTED] |
| Bach. Computing (Hons) | ICQ - 45191180 |
| PhD Student | Office - <Off-Campus> |
| School Comp.Sci & Soft.Eng | Phone - +61 3 9903 2787 (Gen. Office) |
| MONASH (Caulfield Campus) | Fax - +61 3 9903 1077 |
| Melbourne, Australia | |
+----------------------------+--------------------------------------------+
------------------------------
** 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
******************************