0

When I try to call ftok from java using JNA every time I get different key for the same file path and id parameters. Is there some reason in ftok implementation or/and in JVM working mechanism that cause this situation? In native code it's fine - same key fro same parameters.

This is how looks my method in java code:

NativeLong ftok(String path, int id);

How can I solve this problem?

Seems that problem only occurs on remote session, otherwise it's fine. What might be the reason and if there is any solution?

Flxb
  • 33
  • 4
  • Look at the result value in hex. Can you see any pattern in the results? – technomage Apr 10 '14 at 01:05
  • Yes, there is a pattern, here are few sample results: 0x421c82bd 0x421f82bd 0x422182bd – Flxb Apr 11 '14 at 11:49
  • If you make the call three times in succession, do you get different results? What exactly do you mean on "remote session"? If this is happening internal to a web request, and you have one `ftok` call per request, it's entirely possible that the resource you're accessing is specific to the request and not globally unique/available on the system itself. – technomage Apr 11 '14 at 13:36

0 Answers0