Linux-Development-Sys Digest #950, Volume #7 Tue, 13 Jun 00 19:13:20 EDT
Contents:
Re: Dynamic linking shared library (Lac Hao Viet)
Re: Dynamic linking shared library (Kaz Kylheku)
Re: How to mount floppey drive ? (Michael Nadler)
Re: Process path (Paul Kimoto)
Re: mmap on /dev/kmem: sample code? (Emmanuel Dreyfus)
Re: Good Basic compiler for linux? ("Larry Ebbitt ")
Help with Compiler Errors (Timothy Sorrentino)
Get an ide-contr. working on a mips? (Erik Niessen)
Re: Process path (John Reiser)
Re: Help with Compiler Errors (David Weis)
Re: Help with Compiler Errors (Kaz Kylheku)
Re: __init function (David)
Catch system calls from an apps? (Gautier Fabrice)
Re: Catch system calls from an apps? (David A. Lethe)
Re: Get an ide-contr. working on a mips? (Pete Zaitcev)
----------------------------------------------------------------------------
From: Lac Hao Viet <[EMAIL PROTECTED]>
Subject: Re: Dynamic linking shared library
Date: Tue, 13 Jun 2000 16:58:36 GMT
Yes, do man dlopen
In article <8i4ptm$h57$[EMAIL PROTECTED]>,
[EMAIL PROTECTED] wrote:
> Hello
>
> Can I load and link shared library (.so) dynamically the same way as
> using
> LoadLibrary and GetProcAddress
> under Win32?
>
> Thanks in advance
>
> Dmitry
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: Dynamic linking shared library
Reply-To: [EMAIL PROTECTED]
Date: Tue, 13 Jun 2000 17:09:57 GMT
On Wed, 14 Jun 2000 00:52:48 +0800, Nera <[EMAIL PROTECTED]> wrote:
>Hello
>
> Can anyone tell me the concept of dll?
The concept is that you have some machine code on a storage device that you
would like to load and execute at run time.
--
#exclude <windows.h>
------------------------------
From: Michael Nadler <[EMAIL PROTECTED]>
Crossposted-To: linux.help,comp.os.linux.development.apps,comp.os.linux.setup
Subject: Re: How to mount floppey drive ?
Date: Tue, 13 Jun 2000 10:19:29 -0700
Probably need to "mkdir -p /mnt/floppy" first, before trying the suggested
mount command?
Edu wrote:
> If you are trying to mount a DOS disk try:
>
> mount -t msdos /dev/fd0 /mnt/floppy
>
> or
>
> mount -t vfat /dev/fd0 /mnt/floppy
>
> Bye
>
> Robert wrote:
>
> > Hi all
> > I have installed linux redhat 6.0 with KDE in my computer i have little
> > dificulity to mount floppey drive in my computer.
> >
> > I am getting erro as mount: you must specify the file type when i am using
> > the commad : mount /dev/fd0 /mnt
> >
> > i am also getting error as mount: /dev/fd0 is not a valid block when i am
> > using the command
> > mount -t ext2 /dev/fdo /mnt
> >
> > Please helpe me if you know how to do it
> >
> > Thanks in advance Robert
--
>
> The American Republic will endure until the day Congress discovers that it
> can bribe the public with the public's money. --Alexis de Toucqueville (~1805)
------------------------------
From: [EMAIL PROTECTED] (Paul Kimoto)
Subject: Re: Process path
Date: 13 Jun 2000 14:02:47 -0500
Reply-To: [EMAIL PROTECTED]
In article <[EMAIL PROTECTED]>, Gaetan Quentin wrote:
> Hello, i would like to know how to get the process full filename in the
> process itself?
>
> must i check in the PATH variable and check all combinaisons of
> filenames?
Note that the executable may have no name (i.e., the file has been
unlinked) or more than one name. For unix in general, you should
consult #1.14 ("How can I find a process' executable file?") in the
Unix Programming FAQ
(ftp://rtfm.mit.edu/pub/usenet-by-hierarchy/comp/unix/programmer/faq).
On Linux (with /proc), you can look at /proc/$$/exe, where $$ is the
process ID. (For scripts [i.e., programs requiring a runtime
interpreter] this probably is not what you want, however.)
--
Paul Kimoto
------------------------------
From: [EMAIL PROTECTED] (Emmanuel Dreyfus)
Subject: Re: mmap on /dev/kmem: sample code?
Date: Tue, 13 Jun 2000 21:46:51 +0200
Nix <$}xinix{[email protected]> wrote:
> Fragile --- because you have to find System.map (and *assume* it is the
> same as the running kernel, it is hard to check) in order to map
> addresses to symbols. You can't use /proc/ksyms unless you only need to
> look at exported symbols. Both of these are nonportable, of course.
I don't need System.map: I get the address of the bufffer I want to mmap
through an ioctl() call on a driver.
You might tell me that if I have already a device driver, I just have to
mmap() through it. I tried, and I have exactly the same problem with
device driver mmap() and mmap() on /dev/kmem.
Another point: our BSD port mmap() on /dev/kmem, so it's better to keep
them as close as possible. If mmap()'ing on a /dev node is the solution,
I'm ready to do with it, but it does not work.
> Hard to maintain --- grokking around in /dev/kmem is *always* harder
> than other methods. You have to track changes in the format of
> /dev/ksyms/System.map, changes in the precise location of symbols,
> changes in the names of variables...
Don't care: I just want to peek at a table *my* driver maintain. Futre
Linux kernel will not change it.
> Insecure --- your process can now read /dev/kmem. That means it can
> acquire arbitrary data from out of kernel memory. That's a security
> problem and a half, which would vanish completely if you used /proc,
> mmap()ing a /dev node, or anything else.
What is different when you mmap() on a /dev node? In both case security
rely on security checks.
With a /dev node, the security check is in the device driver
With mmap() on /dev/kmem, the security check is in the setgid program
that does the mmap.
In both situations, good security check means security, and bad security
check means security hole.
Anyway, as I explained, I'm okay to mmap() on my device driver, but it
fails the same way as I mmap() on /dev/kmem. I still wonder why...
--
Emmanuel Dreyfus
[EMAIL PROTECTED]
------------------------------
From: "Larry Ebbitt " <[EMAIL PROTECTED]>
Date: Tue, 13 Jun 2000 16:10:13 -0400 (EDT)
Reply-To: "Larry Ebbitt" <[EMAIL PROTECTED]>
Subject: Re: Good Basic compiler for linux?
On Tue, 13 Jun 2000 16:51:55 GMT, Kaz Kylheku wrote:
>Nobody should use BASIC past the age 14.
You're letting it go on way too long.
Larry - Atlanta - IBM Global Services
------------------------------
From: Timothy Sorrentino <[EMAIL PROTECTED]>
Subject: Help with Compiler Errors
Date: Tue, 13 Jun 2000 20:25:39 GMT
Greetings,
This is my first attempt at writing a driver and I am also new to
Linux, so I am quite lost right now! When I try to compile my driver, I
get a lot of error messages about 'Dereferencing to incomplete pointer'
among other error messages. Searching newsgroup postings, this error
seems to be caused a lot by out of date libraries or programs. I'm not
sure if that's what's causing me trouble - the compiler also reports
that there is an error 'Dereferencing to incomplete pointer' in Time.h
of the Linux distribution, leading me to believe that some of my Linux
components might need to updated. Has anyone else ran in to this and
can help me get my driver to compile? Is it out of date libraries or an
error in my code?
If it helps, I just installed Red Hat 6.1 and have not upgraded any
packages. I have Libc 6 2.1.2 and 'gcc --version' reports 'egcs
2.91.66'
TIA,
Tim
Here's a portion of the code with errors, if it's useful: I'm tyring to
compile it by 'gcc -o tmdriver driver.c'
Let me know if I need to provide more info
static int TMpci_open(struct inode * inode, struct file * filp)
{
MOD_INC_USE_COUNT;
switch (MINOR(inode->i_rdev)) // !!! Derefrencing pointer to
incomplete type
{
case 1:
if (noBoard)
return -ENODEV;
filp->f_op = &TMpci_mem_fops; // !!! Derefrencing pointer to
incomplete type
break;
default:
return -ENODEV;
}
return 0;
}
static int TMpci_close(struct inode * inode, struct file * filp)
{
MOD_DEC_USE_COUNT;
return 0;
}
struct file_operations TMpci_fops = { // !!! Has initializer but
incomplete type
NULL, // lseek
NULL, // read
NULL, // write
NULL, // readdir
NULL, // poll
NULL, // ioctl
NULL, // mmap
TMpci_open, // open
NULL, // flush
TMpci_close, // release
NULL, // fsync
NULL, // fasync
NULL, // check_media_change
NULL, // revalidate
NULL // lock
};
------------------------------
Date: Tue, 13 Jun 2000 13:40:26 -0700
From: Erik Niessen <[EMAIL PROTECTED]>
Subject: Get an ide-contr. working on a mips?
Hello,
I am trying to get a CMD-646 ide-controller working on an embedded
mips-platform.
Here is what I tried so far. I got the source from ftp.mips.com.
Compiled it and the
core-kernel is working now. I put the ide pci-card in and I changed the
setup file so
that ide_ops is using the std_ide_ops. I recompiled and try to boot,
but no luck.
Have a look at the output:
CMD646: IDE controller on PCI bus 00 dev 98
CMD646: not 100% native mode: will probe irqs later
EN: hwif->io_ports[IDE_SELECT_OFFSET]=0xfffe
probing for hda: present=0, media=32, probetype=ATA
Unable to handle kernel paging request at virtual address 0000fffe, epc
== 800c3
980, ra == 800c3958
Oops: 0001
It seems the IDE-driver is not yet ready for the mips? After some
debugging it seems
that the oops is at the line SELECT_DRIVE(hwif,drive) in ide-probe.c.
This line does
an OUT_BYTE and it uses the hwif->io_ports as input. That is incorrect
it should use
the base-address. So instead of the SELECT_DRIVE I did a OUT_BYTE with
base-address0 and I get the following output
CMD646: IDE controller on PCI bus 00 dev 98
CMD646: not 100% native mode: will probe irqs later
EN: hwif->io_ports[IDE_SELECT_OFFSET]=0xfffe
probing for hda: present=0, media=32, probetype=ATA
Unable to handle kernel paging request at virtual address 11fffffe, epc
== 800c3
970, ra == 800c3960
Oops: 0001
$0 : 00000000 800f0000 11fffffe 000000a0
$4 : 800f2194 00000001 00000034 1000fc01
$8 : 0000fc00 ffff00ff 00000001 00000000
$12: 800ddb30 00000020 80187335 80187336
$16: 11fffffe 80186bb0 80186bb0 80186b94
$20: 000000ec 80186bf8 80186bd2 80186be8
$24: 0000006b 00000064
$28: 80ff8000 80ff9e58 80186be2 800c3960
epc : 800c3970
Status: 1000fc03
Cause : 0080000c
Process swapper (pid: 1, stackpage=80ff8000)
Stack: 800dc010 80186c00 00000000 00000020 800dc044 800e7498 80186bd0
80186bb0
80186c00 00000000 80186b94 800c3ddc 00000000 00000000 80ffc7fc
80ffc800
800e95ac 1000fc01 1000fc01 80186cc1 80186be3 0000000a 00000000
80ff9ee8
80186b94 0000000a 00000001 80010428 04000000 00000000 80186be2
800c4af8
8016e94d 0000003c 06461095 00808000 00000001 00000001 00000001
00000001
00000001 ...
Call Trace: [<800dc010>] [<800dc044>] [<800c3ddc>] [<800c4af8>]
[<800682a4>] [<8
00dba78>] [<8006a258>] [<800682a4>] [<800682a4>] [<800682a4>]
[<800682b4>] [<800
7a03c>] [<800d4494>] [<8006a268>] [<8006a258>]
Code: 8c420af0 92430024 00501021 <a0430000> 3c04800e 0c01e776
2484c050 0c03
0cc4 00000000
Some questions:
- Can I safely use the OUT_BYTE function on the mips?
- How do I communicate with the ide-drive correctly?
- Maybe someone can give me a pointer that would solve my problem?
Thanks for reading so for and I hope someone can help me out.
Cheers,
Erik
------------------------------
From: John Reiser <[EMAIL PROTECTED]>
Subject: Re: Process path
Date: Tue, 13 Jun 2000 13:44:04 -0700
> On Linux (with /proc), you can look at /proc/$$/exe, where $$ is the
> process ID.
On Linux there is also "/proc/self/exe" which is a literal constant.
=====
$ ls -l /proc/self/exe
lrwx------ 1 user users 0 Jun 13 00:00 /proc/self/exe -> /bin/ls
$
=====
Also on Linux, the pathname at the time of exec is put at the fixed end
of the stack. On many common Linux x86 distributions where the stack ends
at 0xc0000000, the 32-bits at 0xbffffffc is 0, and the '\0' which terminates
the pathname at time of exec is at 0xbffffffb. Search backwards for another
'\0', and the pathname lies between.
--
John Reiser
------------------------------
From: David Weis <[EMAIL PROTECTED]>
Subject: Re: Help with Compiler Errors
Date: Tue, 13 Jun 2000 15:48:11 -0500
A few things I noticed:
Make sure you are putting the array declaration for TMpci_mem_fops before
you are using it, unless it has a forward declaration.
Be sure you are including the file linux/fs.h
david
On Tue, 13 Jun 2000, Timothy Sorrentino wrote:
> Greetings,
> This is my first attempt at writing a driver and I am also new to
> Linux, so I am quite lost right now! When I try to compile my driver, I
>
> get a lot of error messages about 'Dereferencing to incomplete pointer'
> among other error messages. Searching newsgroup postings, this error
> seems to be caused a lot by out of date libraries or programs. I'm not
> sure if that's what's causing me trouble - the compiler also reports
> that there is an error 'Dereferencing to incomplete pointer' in Time.h
> of the Linux distribution, leading me to believe that some of my Linux
> components might need to updated. Has anyone else ran in to this and
> can help me get my driver to compile? Is it out of date libraries or an
>
> error in my code?
>
> If it helps, I just installed Red Hat 6.1 and have not upgraded any
> packages. I have Libc 6 2.1.2 and 'gcc --version' reports 'egcs
> 2.91.66'
>
> TIA,
> Tim
>
> Here's a portion of the code with errors, if it's useful: I'm tyring to
>
> compile it by 'gcc -o tmdriver driver.c'
> Let me know if I need to provide more info
>
> static int TMpci_open(struct inode * inode, struct file * filp)
> {
> MOD_INC_USE_COUNT;
> switch (MINOR(inode->i_rdev)) // !!! Derefrencing pointer to
> incomplete type
> {
> case 1:
> if (noBoard)
> return -ENODEV;
> filp->f_op = &TMpci_mem_fops; // !!! Derefrencing pointer to
> incomplete type
> break;
> default:
> return -ENODEV;
> }
> return 0;
> }
>
> static int TMpci_close(struct inode * inode, struct file * filp)
> {
> MOD_DEC_USE_COUNT;
> return 0;
> }
>
> struct file_operations TMpci_fops = { // !!! Has initializer but
> incomplete type
> NULL, // lseek
> NULL, // read
> NULL, // write
> NULL, // readdir
> NULL, // poll
> NULL, // ioctl
> NULL, // mmap
> TMpci_open, // open
> NULL, // flush
> TMpci_close, // release
> NULL, // fsync
> NULL, // fasync
> NULL, // check_media_change
> NULL, // revalidate
> NULL // lock
> };
>
>
>
>
>
>
--
David Weis | 10520 New York Ave, Des Moines, IA 50322
[EMAIL PROTECTED] | Voice 515-278-0133 Ext 231
| http://www.perfectionlearning.com/
When they took the Fourth Amendment, I was quiet because I didn't deal drugs.
When they took the Fifth Amendment, I was quiet because I was innocent.
When they took the Second Amendment, I was quiet because I didn't own a gun.
Now they've taken the First Amendment and I can't say anything.
------------------------------
From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: Help with Compiler Errors
Reply-To: [EMAIL PROTECTED]
Date: Tue, 13 Jun 2000 21:01:06 GMT
On Tue, 13 Jun 2000 20:25:39 GMT, Timothy Sorrentino <[EMAIL PROTECTED]> wrote:
>Greetings,
> This is my first attempt at writing a driver and I am also new to
>Linux, so I am quite lost right now! When I try to compile my driver, I
>
>get a lot of error messages about 'Dereferencing to incomplete pointer'
>among other error messages.
[snip ]
>Searching newsgroup postings, this error
>seems to be caused a lot by out of date libraries or programs.
You can't use your system libraries in the kernel.
>static int TMpci_open(struct inode * inode, struct file * filp)
>{
> MOD_INC_USE_COUNT;
> switch (MINOR(inode->i_rdev)) // !!! Derefrencing pointer to
>incomplete type
Do you know what an incomplete type is? It's a type that is declared when a
struct or union tag is introduced without the struct body, or when an array is
declared without a dimension. You cannot define objects having an incomplete
type, nor can you dereference pointers to incomplete types.
What is likely happening is that you have not included the correct header which
defines the complete type ``struct inode''. Thus the type ``struct inode'' in
this scope then comes from the function's own parameter declaration, which
makes it an incomplete type.
--
#exclude <windows.h>
------------------------------
From: David <[EMAIL PROTECTED]>
Subject: Re: __init function
Date: Wed, 14 Jun 2000 00:47:19 +0200
Arnaud Westenberg wrote:
>
> Hi all,
>
> I would like to get rid of initialization code in my loadable module,
> however __init only works when the code is linked into the kernel.
>
> Are there any other ways to get rid of my initialization code?
>
> Thanks
>
> Regards Arnaud
YES, user __atributte__(constructor) to determine which functions are
called when you link with library or before your main.
Of course, you can use destructor option to call this function after
main exits.
Good Luck,
DTM
------------------------------
From: Gautier Fabrice <[EMAIL PROTECTED]>
Subject: Catch system calls from an apps?
Date: 14 Jun 2000 00:26:44 +0200
Hi,
I'm looking for a way to catch and redirect system calls from an app.
I know programs like strace are able to catch and records the system
calls (so i may look at the source) but i would like to know if there
is a way to really interrupt the call and execute another piece of
code?
For the moment i'm only looking for system calls but i may want to
catch libc calls (in programs dynamically linked with) or any other
dynamic librairies calls. (Indeed, if there is a way to catch libc
call there is a way to catch system calls).
Thanks if you can help
(Mail-Followup welcomed)
and sorry for my not so good english
A+
--
Fabrice Gautier
[EMAIL PROTECTED]
------------------------------
From: [EMAIL PROTECTED] (David A. Lethe)
Subject: Re: Catch system calls from an apps?
Date: Tue, 13 Jun 2000 22:58:14 GMT
On 14 Jun 2000 00:26:44 +0200, Gautier Fabrice <[EMAIL PROTECTED]>
wrote:
>
>Hi,
>
>I'm looking for a way to catch and redirect system calls from an app.
>
>I know programs like strace are able to catch and records the system
>calls (so i may look at the source) but i would like to know if there
>is a way to really interrupt the call and execute another piece of
>code?
>
>For the moment i'm only looking for system calls but i may want to
>catch libc calls (in programs dynamically linked with) or any other
>dynamic librairies calls. (Indeed, if there is a way to catch libc
>call there is a way to catch system calls).
>
>Thanks if you can help
>
>(Mail-Followup welcomed)
>
>and sorry for my not so good english
>
>A+
>
>
>--
>Fabrice Gautier
>[EMAIL PROTECTED]
It is possible, Computer Associates have been doing for many years now
with unicenter. The way I remember they do it, requires kernel
patches. It also slow things down a bit.
I don't think there is another 100% reliable way to accomplish this.
------------------------------
From: [EMAIL PROTECTED] (Pete Zaitcev)
Subject: Re: Get an ide-contr. working on a mips?
Date: Tue, 13 Jun 2000 23:01:23 GMT
> I am trying to get a CMD-646 ide-controller working on an embedded
> mips-platform. [...] I put the ide pci-card in and I changed the
> setup file so that ide_ops is using the std_ide_ops.
> Cheers,
> Erik
Why did you need to modify ops? Just use the standard PCI IDE
and do not enable chipset support. If that works, enable chipset
support, but be careful. There is one CMD64x version that is meant
to work on sparc and is not cross-platform. Make sure you are not
hitting that.
--Pete
------------------------------
** 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
******************************