Linux-Development-Sys Digest #65, Volume #8 Fri, 4 Aug 00 19:13:16 EDT
Contents:
Using JNI on Linux (Michael M. Welch)
Re: Using JNI on Linux (Robert Lynch)
Non-Driver phys_to_virt (Mike Asbury)
Re: glibc bug? (Villy Kruse)
Re: problem with open files (Nix)
Re: read() and directories (Nix)
Re: streams (Nix)
"Need Program For PAL- 16L8 & EPROM 2764" (wilfred)
Re: Ncurses version check (Marco van de Voort)
NTFS Support Thanks ("Kent Bergelin")
Re: Intel OR840 Hang (Tor Arntsen)
Parallel Interface Info? (Alan L. Folsom, Jr.)
Re: glibc bug strtol (Ian D Romanick)
Re: linux device drivers info (Rick Ellis)
Re: glibc bug? (Rick Ellis)
MOD_INC_USE_COUNT does not work! ([EMAIL PROTECTED])
Re: glibc bug strtol (Kaz Kylheku)
SMP ("Gary James")
Kernel Versions and depmod (Mike)
Re: Linux driver for canon BJC 5100 color bubble jet printer ("John Martin")
Time interval command for the kernel side ("Rob Morris")
Re: Using JNI on Linux (Michael M. Welch)
Re: Using JNI on Linux (Juergen Kreileder)
----------------------------------------------------------------------------
From: [EMAIL PROTECTED] (Michael M. Welch)
Crossposted-To: comp.lang.java.programmer,comp.lang.java.help
Subject: Using JNI on Linux
Date: 4 Aug 2000 04:22:00 GMT
I have a Java Native Interface implementation that has been
running on Solaris that I now need to run on Linux. However, I
am new to using Linux and am running into trouble. The native
code is compiled into a shared library that the Java code loads
to access the native functions. Like I said, I got this going
just fine on Solaris but I can't get it working when I recompile
the native source on Linux. Are there any gotchas with regard
to creating shared libraries in Linux that may be obvious to
more seasoned users but maybe not so obvious to me?
I created the library according to the steps given in Java
Tip 23 at javaworld.com but no dice. When I try to run the Java
program, the result is an UnsatisfiedLinkError when the Java
program attempts to load the library. (Yes, I did remember to
appropriately set my LD_LIBRARY_PATH and I have double-, triple-
and quadruple-checked it.)
I'm missing something REALLY simple here, aren't I?
- Michael
http://www.Michael.Welch.net/
--
Michael M. Welch
[EMAIL PROTECTED]
http://www.Michael.Welch.net/
------------------------------
From: Robert Lynch <[EMAIL PROTECTED]>
Crossposted-To: comp.lang.java.programmer,comp.lang.java.help
Subject: Re: Using JNI on Linux
Date: Thu, 03 Aug 2000 22:10:00 -0700
Reply-To: [EMAIL PROTECTED]
"Michael M. Welch" wrote:
>
> I have a Java Native Interface implementation that has been
> running on Solaris that I now need to run on Linux. However, I
> am new to using Linux and am running into trouble. The native
> code is compiled into a shared library that the Java code loads
> to access the native functions. Like I said, I got this going
> just fine on Solaris but I can't get it working when I recompile
> the native source on Linux. Are there any gotchas with regard
> to creating shared libraries in Linux that may be obvious to
> more seasoned users but maybe not so obvious to me?
>
> I created the library according to the steps given in Java
> Tip 23 at javaworld.com but no dice. When I try to run the Java
> program, the result is an UnsatisfiedLinkError when the Java
> program attempts to load the library. (Yes, I did remember to
> appropriately set my LD_LIBRARY_PATH and I have double-, triple-
> and quadruple-checked it.)
>
> I'm missing something REALLY simple here, aren't I?
>
> - Michael
> http://www.Michael.Welch.net/
> --
> Michael M. Welch
> [EMAIL PROTECTED]
> http://www.Michael.Welch.net/
IMO, your LD_LIBRARY_PATH is not set correctly. To check, run your app
like this:
export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH; /usr/local/jdk1.2.2/bin/java
HelloWorld
(assuming .so is in current directory). Here's an example where I use a
makefile:
====
$ make
rm -f HelloWorld.class
javac HelloWorld.java
/usr/local/jdk1.2.2/bin/javah -jni HelloWorld
g++ -I/usr/local/jdk1.2.2/include -I/usr/local/jdk1.2.2/include/linux
-L/usr/local/jdk1.2.2/jre/lib/i386 -c HelloWorldImpl.C
g++ -fPIC -shared -I/usr/local/jdk1.2.2/include
-I/usr/local/jdk1.2.2/include/linux -L/usr/local/jdk1.2.2/jre/lib/i386
HelloWorldImpl.o -ljava -o libHelloWorldImpl.so
rm -f HelloWorldImpl.o
export LD_LIBRARY_PATH=.:; /usr/local/jdk1.2.2/bin/java HelloWorld
Hello Native World
====
Here the .so lib is in the current directory since:
====
$ cat HelloWorld.java
public class HelloWorld
{
public native void displayHelloWorld();
static
{
System.loadLibrary( "HelloWorldImpl" ); // assumed in current
directory
}
public static void main( String[] argv )
{
HelloWorld hw = new HelloWorld();
hw.displayHelloWorld();
}
}
====
HTH. Bob L.
--
Robert Lynch-Berkeley CA [EMAIL PROTECTED]
------------------------------
From: Mike Asbury <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
Subject: Non-Driver phys_to_virt
Date: Fri, 04 Aug 2000 05:29:37 GMT
Is there a way to convert Physical addresses to virtual addresses
(outside of a driver)?
I have a PCI device that I am playing around with. I am able to read
the Physical address
stored in the base address registers. I would like to read/write that
physical addess (which means I need a virtual pointer).
I have seen the functions ioremap and phys_to_virt, but those only work
when __KERNEL__ is defined.
Is there any way to do this outside of writng a driver?
------------------------------
From: [EMAIL PROTECTED] (Villy Kruse)
Subject: Re: glibc bug?
Date: 4 Aug 2000 06:50:57 GMT
On Thu, 03 Aug 2000 23:32:25 GMT, Pete Zaitcev <[EMAIL PROTECTED]> wrote:
>On Thu, 03 Aug 2000 13:14:31 -0700, tye4 <[EMAIL PROTECTED]> wrote:
>> A NULL passed to strcmp() and similar functions causes segmentation
>> fault:
>>
>> // crash
>> strcmp( NULL, "something" );
>> strcmp( "something", NULL );
>>
>> Is this a bug, or are my man pages outdated?
>>
>> tye4
>
>This is to be expected, and my man pages do not say that NULL is
>permitted. What system are you at and what man page do you mean?
>
>--Pete
On some systems you crash the program, on some system you compare
something to garbage, on some systems that garbage can even be a zero
length string; you just can't know, so don't do it.
Villy
------------------------------
From: Nix <$}xinix{[email protected]>
Subject: Re: problem with open files
Date: 03 Aug 2000 23:43:42 +0100
Lew Pitcher <[EMAIL PROTECTED]> writes:
> The filespace utilities count space used by filenames (i.e. df) or
> used by everything (du).
You got those two backwards.
--
`I am of the belief that catnip arrived on the planet in the same spaceship
that delivered cats. It is the only thing they have from their home
planet. Tuna, chicken, sparrow-brains, etc., these are all things of our
world that they like, but catnip is crack from home.' --- Bill Cole
------------------------------
From: Nix <$}xinix{[email protected]>
Subject: Re: read() and directories
Date: 04 Aug 2000 00:02:16 +0100
[EMAIL PROTECTED] (Alexander Viro) writes:
> NOT. Don't *WHAM* add *WHAM* random features to basic utilities *WHAM*
> *WHAM* *WHAM*. Remember "should be doing one thing and doing it well"?
Yes, but GNU diff and perl both show us that doing one thing and doing
it well only counts if you also add on so many bells and whistles that
the original purpose of the program almost disappears underneath all the
chrome.
(Although I actually *use* nearly all of GNU diff's features from time
to time. This frightens me.)
--
`I am of the belief that catnip arrived on the planet in the same spaceship
that delivered cats. It is the only thing they have from their home
planet. Tuna, chicken, sparrow-brains, etc., these are all things of our
world that they like, but catnip is crack from home.' --- Bill Cole
------------------------------
From: Nix <$}xinix{[email protected]>
Subject: Re: streams
Date: 04 Aug 2000 00:07:03 +0100
[EMAIL PROTECTED] (Alexander Viro) writes:
> In article <[EMAIL PROTECTED]>,
> Oliver Kowalke <[EMAIL PROTECTED]> wrote:
> >Hi,
> >
> >I'm currently reading APUE from W.R. Stevens and I've two questions:
> >1.) Are streams in linux implemented?
> Not in the main tree. Patch exists but the hell will freeze before
> it will get there.
... although I have been getting an itch to implement *real* streams
(Ritchie streams) if I can figure out a fast way to do it (i.e. without
loads of copying for big stacks. It should be possible to do some COW
optimizations, but setting up COW pages is slow. Agh.)
--
`I am of the belief that catnip arrived on the planet in the same spaceship
that delivered cats. It is the only thing they have from their home
planet. Tuna, chicken, sparrow-brains, etc., these are all things of our
world that they like, but catnip is crack from home.' --- Bill Cole
------------------------------
From: wilfred <[EMAIL PROTECTED]>
Subject: "Need Program For PAL- 16L8 & EPROM 2764"
Date: Fri, 04 Aug 2000 07:30:04 GMT
I'm currently doing my final year project on 68k microprocessor
while in the installation process of hardware i lack of program that needed to burn in
the PAL & EPROM. so anybody outthere can do me a fovour by helping me searching the
needed program. Hope to hear from u all soon.
THANKS.
--
Posted via CNET Help.com
http://www.help.com/
------------------------------
From: [EMAIL PROTECTED] (Marco van de Voort)
Subject: Re: Ncurses version check
Date: 4 Aug 2000 08:19:28 GMT
>>>
>>>> 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 :-)
>
>I understood that by context (pascal).
Sorry then. Often people don't get the problem.
>But what "function" are you
>referring to for the version?
It was not a detection routine, but more an initialising routine:
Until now we used setupterm to get terminal data, and since that structure
was different, we figured out a quick and dirty way to patch it.
This works well under 4 and 5, which is good enough for Linux. On FreeBSD
however Ncurses 3.x is still used in a lot of places.
------------------------------
From: "Kent Bergelin" <[EMAIL PROTECTED]>
Subject: NTFS Support Thanks
Date: Fri, 4 Aug 2000 10:23:11 +0200
As You pointed out, I found the ntfs support in the kernel config options.
Thanks for help
Kent
------------------------------
From: [EMAIL PROTECTED] (Tor Arntsen)
Subject: Re: Intel OR840 Hang
Date: Fri, 04 Aug 2000 13:52:41 GMT
"D. Stimits" <[EMAIL PROTECTED]> writes:
>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.
Thanks a lot for these suggestions. At the current moment I can't
boot and check the log (my monitor is away) but what you describe
looks very similar to what I see (it doesn't matter if I replace
the scsi with IDE etc.).
Thanks,
-Tor
------------------------------
Subject: Parallel Interface Info?
From: [EMAIL PROTECTED] (Alan L. Folsom, Jr.)
Date: Fri, 04 Aug 2000 14:48:57 GMT
Please forgive any newbie faux-paus, There is a ton of information
available on Linux, and I'm having trouble winnowing through it!
I am new to Linux, although I used Unix a lot about 7 years ago. I need to
interface to a custom device using a bidirectional parallel port. The
device can operate in either a normal DMA block mode, or ECP mode. Do the
standard Linux parallel port drivers support this? Are there any drivers
available otherwise to support bidirectional parallel and ECP?
I don't mind doing driver work if necessary, but would prefer to avoid it.
If you can direct me to any tutorials or other help for this, I would very
much appreciate it.
Thanks,
Al F.
--
=========================================================
Alan L. Folsom, Jr. Phone:215 628-0840
PO Box 481, 904 Sheble Lane Fax: 215 628-0353
Spring House, PA 19477 [EMAIL PROTECTED]
=========================================================
------------------------------
From: [EMAIL PROTECTED] (Ian D Romanick)
Crossposted-To: comp.os.linux.development.apps
Subject: Re: glibc bug strtol
Date: 4 Aug 2000 08:44:57 -0700
tye4 <[EMAIL PROTECTED]> writes:
>In any case, setting errno to 0 is not a good idea in a multithreaded program because
>you might erase errno's value set by some other system function.
Huh? errno is thread specific data. You can set it to whatever value you
want in one thread and it will *do nothing* in the other thread. If your
implementation does otherwise, it is wrong.
--
"I used to hang out by the food table at parties
because you don't really have to talk to anybody,
and if you do, you can talk about the food."
-- Jennifer Jason Leigh http://www.cs.pdx.edu/~idr/
------------------------------
From: [EMAIL PROTECTED] (Rick Ellis)
Subject: Re: linux device drivers info
Date: 4 Aug 2000 15:48:43 GMT
In article <[EMAIL PROTECTED]>, Kai Xu <[EMAIL PROTECTED]> wrote:
>Where did you find the "Linux Kernel Module Programming Guide" ?
>I searched the www.linuxdoc.org and couldn't find it.
http://www.linuxdoc.org/LDP/lkmpg/mpg.html
--
http://www.fnet.net/~ellis/photo/linux.html
------------------------------
From: [EMAIL PROTECTED] (Rick Ellis)
Subject: Re: glibc bug?
Date: 4 Aug 2000 16:13:21 GMT
In article <[EMAIL PROTECTED]>, tye4 <[EMAIL PROTECTED]> wrote:
>A NULL passed to strcmp() and similar functions causes segmentation
>fault:
>
>// crash
>strcmp( NULL, "something" );
>strcmp( "something", NULL );
>
>Is this a bug, or are my man pages outdated?
Are you surprised that dereferencing a NULL pointer causes a seg fault? I
suppose strcmp could be coded to check for NULL arguments but why would you
want to performance hit?
--
http://www.fnet.net/~ellis/photo/
------------------------------
From: [EMAIL PROTECTED]
Subject: MOD_INC_USE_COUNT does not work!
Date: Fri, 04 Aug 2000 16:20:14 GMT
I'm writing a char device driver and still have a small problem.
I setting the filep->f_op in my standard-open function depending
on the minor-number.
Here some of my code:
switch (MINOR(inodep->i_rdev))
{
case 0:
filep->f_op = &da_fops;
return filep->f_op->open(inodep, filep);
break;
case 1:
....
}
As you can see, i call the specific open function.
In that open-function i have included MOD_INC_USE_COUNT
but if i'm looking with "lsmod" after opening the device
the usecount is still 0!
If i use MOD_INC_USE_COUNT before i call my specific open,
then the MOD_DEC_USE_COUNT in my specific release has no
effect and i'm unable to remove the module without booting :-(
The whole driver is splitted in several .c-files.
Does anyone know a solution?
(i'm still using Kernel 2.2.5)
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
From: [EMAIL PROTECTED] (Kaz Kylheku)
Crossposted-To: comp.os.linux.development.apps
Subject: Re: glibc bug strtol
Reply-To: [EMAIL PROTECTED]
Date: Fri, 04 Aug 2000 17:24:00 GMT
On 4 Aug 2000 08:44:57 -0700, Ian D Romanick <[EMAIL PROTECTED]> wrote:
>tye4 <[EMAIL PROTECTED]> writes:
>
>>In any case, setting errno to 0 is not a good idea in a multithreaded program because
>>you might erase errno's value set by some other system function.
>
>Huh? errno is thread specific data. You can set it to whatever value you
>want in one thread and it will *do nothing* in the other thread. If your
>implementation does otherwise, it is wrong.
Unless, of course, you forget to compile with -D_REENTRANT. ;) ;)
------------------------------
From: "Gary James" <[EMAIL PROTECTED]>
Subject: SMP
Date: Fri, 4 Aug 2000 14:37:58 -0500
I am attempting to recompile my driver (simple kernel mode driver) for SMP.
(2.2.12-20 linux red hat 6.1) The driver compiles fine, however when I
insmod the
driver, insmod tells me that it can't resolve certain functions. These
functions are the
"standard" kernel calls for such things as copy_from_user, printk, and
pci.....
This should be simple - I was hoping to be debugging locks and such by now,
but I need the magic incantation that lets me in.
Any ideas?
(both with and without -D__SMP__ in the compile line have been tried)
------------------------------
From: Mike <[EMAIL PROTECTED]>
Subject: Kernel Versions and depmod
Date: Fri, 04 Aug 2000 20:30:05 GMT
I recently moved from a test kernel to the last 2.2.xx kernel. I had to do
this due to the fact that the tdfx.o module currently will not compile on
the text kernel. The problem I am having is this. When I compile my
modules and do depmod - it uses the 2.4 test kernel directory instead of my
2.2 module directory, and I also get loads of unresolved symbol errors.
Any help would be greatly appriceated.
Mike
--
Posted via CNET Help.com
http://www.help.com/
------------------------------
From: "John Martin" <[EMAIL PROTECTED]>
Subject: Re: Linux driver for canon BJC 5100 color bubble jet printer
Date: Fri, 4 Aug 2000 14:23:06 -0700
Hello
I checked the linux driver bank and could not find the proper drivers for my
new printer. Is there a Linux driver for canon BJC 5100 color bubble jet
printer?
John Martin
[EMAIL PROTECTED]
------------------------------
From: "Rob Morris" <[EMAIL PROTECTED]>
Subject: Time interval command for the kernel side
Date: Fri, 4 Aug 2000 14:55:11 -0700
We are instrumenting the kernel to get an idle profile of the number of
times the modules are called within a given set of time. Was wondering if
there is any KERNEL or USER side commands for making time stamps that are
less than one second? We have the time stamps for over a second, but having
trouble getting information on how to set a time interval for less than a
second.
Would appreciate any information on this subject.
Thanks,
Rob
------------------------------
From: [EMAIL PROTECTED] (Michael M. Welch)
Crossposted-To: comp.lang.java.programmer,comp.lang.java.help
Subject: Re: Using JNI on Linux
Date: 4 Aug 2000 22:16:37 GMT
In article <[EMAIL PROTECTED]>,
Robert Lynch <[EMAIL PROTECTED]> wrote:
>"Michael M. Welch" wrote:
>>
>> I have a Java Native Interface implementation that has been
>> running on Solaris that I now need to run on Linux. However, I
>> am new to using Linux and am running into trouble. The native
>> code is compiled into a shared library that the Java code loads
>> to access the native functions. Like I said, I got this going
>> just fine on Solaris but I can't get it working when I recompile
>> the native source on Linux. Are there any gotchas with regard
>> to creating shared libraries in Linux that may be obvious to
>> more seasoned users but maybe not so obvious to me?
>>
>> I created the library according to the steps given in Java
>> Tip 23 at javaworld.com but no dice. When I try to run the Java
>> program, the result is an UnsatisfiedLinkError when the Java
>> program attempts to load the library. (Yes, I did remember to
>> appropriately set my LD_LIBRARY_PATH and I have double-, triple-
>> and quadruple-checked it.)
>>
>> I'm missing something REALLY simple here, aren't I?
>>
>> - Michael
>>
>> --
>> Michael M. Welch
>> [EMAIL PROTECTED]
>> http://www.Michael.Welch.net/
>
>IMO, your LD_LIBRARY_PATH is not set correctly. To check, run your app
>like this:
>
>export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH; /usr/local/jdk1.2.2/bin/java
>HelloWorld
Trust me, I've checked, re-checked and re-checked again the
LD_LIBRARY_PATH. I narrowed it down by keeping everything in the
current directory and taking Java out of the equation. I created
a Test.cxx file that required the loading of the same shared
library in order to link. I verified that this C++ program would
only run with LD_LIBRARY_PATH including the current directory.
Even when that program runs correctly, my Java program still
cannot load this very same library in this very same directory.
One thing I did notice in doing this though is that unlike on
Solaris, when I'm on Linux the LD_LIBRARY_PATH seems to apply only
at run-time and not at link-time. On Solaris, when I compile and
link Test.cxx, I don't have to pass -L. to g++ if LD_LIBRARY_PATH
includes the current directory. But on Linux, I must always link
with -L. regardless of the LD_LIBRARY_PATH setting. I don't see
how this explains my JNI problem since that's occurring at run-time,
but I'm wondering if this difference between the O/S's might be
somehow related to my problem.
- Michael
--
Michael M. Welch
[EMAIL PROTECTED]
http://www.Michael.Welch.net/
------------------------------
From: Juergen Kreileder <[EMAIL PROTECTED]>
Crossposted-To: comp.lang.java.programmer,comp.lang.java.help
Subject: Re: Using JNI on Linux
Date: 05 Aug 2000 00:53:37 +0200
>>>>> "Michael" == Michael M Welch <[EMAIL PROTECTED]> writes:
Michael> In article <[EMAIL PROTECTED]>,
Michael> Robert Lynch <[EMAIL PROTECTED]> wrote:
>> "Michael M. Welch" wrote:
>>>
>>> I have a Java Native Interface implementation that has been
>>> running on Solaris that I now need to run on Linux. However, I
>>> am new to using Linux and am running into trouble. The native
>>> code is compiled into a shared library that the Java code loads
>>> to access the native functions. Like I said, I got this going
>>> just fine on Solaris but I can't get it working when I recompile
>>> the native source on Linux. Are there any gotchas with regard
>>> to creating shared libraries in Linux that may be obvious to
>>> more seasoned users but maybe not so obvious to me?
>>>
>>> I created the library according to the steps given in Java
>>> Tip 23 at javaworld.com but no dice. When I try to run the Java
>>> program, the result is an UnsatisfiedLinkError when the Java
>>> program attempts to load the library. (Yes, I did remember to
>>> appropriately set my LD_LIBRARY_PATH and I have double-, triple-
>>> and quadruple-checked it.)
A wrong LD_LIBRARY_PATH is not the only thing that can cause an
UnsatisifiedLinkError. Post a small example and include the commands
you've used to build the library.
Juergen
--
Juergen Kreileder, Blackdown Java-Linux Team
http://www.blackdown.org/java-linux.html
JVM'01: http://www.usenix.org/events/jvm01/
------------------------------
** 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
******************************