LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 06-24-2012, 01:20 PM   #16
basudebg
LQ Newbie
 
Registered: May 2012
Posts: 25

Original Poster
Rep: Reputation: Disabled

I originally started writing wxFile class and wxSeek functions, As that was crashing, I wanted to do away with it and use plain lseek. Even now I want get around the problem and want to call lseek function. Is there any way to do that? As the function is not reaching lseek at all in this case, there has to be some problem in compiling the code. So, how do I get rid of that?

I am not conversant with coredump, but I think this is a very complicated way to discover a bug in the library, as wxWidgets should clarify/correct it.
 
Old 06-24-2012, 01:29 PM   #17
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,930

Rep: Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320
if you have a simple case just report it to the developers, you do not need to analyze or solve it. However the stack trace may give a lot of info about the problem.
So if you want to solve this I recommend you to make a library without wxWidgets and this implements your file i/o (you can also try to link statically the runtime). You will use this lib in your app with wxWidgets instead of the original runtime (so you will have my_lseek, my_open or similar)
 
Old 06-24-2012, 02:04 PM   #18
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 676

Rep: Reputation: 137Reputation: 137
Quote:
Originally Posted by basudebg View Post
I originally started writing wxFile class and wxSeek functions, As that was crashing, I wanted to do away with it and use plain lseek. Even now I want get around the problem and want to call lseek function. Is there any way to do that? As the function is not reaching lseek at all in this case, there has to be some problem in compiling the code. So, how do I get rid of that?

I am not conversant with coredump, but I think this is a very complicated way to discover a bug in the library, as wxWidgets should clarify/correct it.
I see two ways to bypass wxWidget's lseek and call the real one:

use dlopen
Code:
handler = dlopen("libc.so.6", ...);
true_lseek = dlsym(handler, "lseek");
true_lseek(....);
Or write your own lseek function and call call lseek syscall directly.
But this (assembler) function shoul be changed for each new processor or operation system

So first solution is more portable
 
Old 06-24-2012, 10:03 PM   #19
basudebg
LQ Newbie
 
Registered: May 2012
Posts: 25

Original Poster
Rep: Reputation: Disabled
Thank you for the help. I reported the issue to the developers but have not got their response yet. But the solution:

handler = dlopen("libc.so.6", ...);
true_lseek = dlsym(handler, "lseek");
true_lseek(....);

is the one probably I was looking for. It seems to work fine, at least the core dump is gone. I would say the issue is solved.
 
Old 06-24-2012, 11:23 PM   #20
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 676

Rep: Reputation: 137Reputation: 137
Quote:
Originally Posted by basudebg View Post
Thank you for the help. I reported the issue to the developers but have not got their response yet. But the solution:

handler = dlopen("libc.so.6", ...);
true_lseek = dlsym(handler, "lseek");
true_lseek(....);

is the one probably I was looking for. It seems to work fine, at least the core dump is gone. I would say the issue is solved.
Glad it works for you. Let us know what response will you get from wxWidget developeers.
 
Old 06-25-2012, 12:12 AM   #21
vramesh1981
LQ Newbie
 
Registered: Jun 2012
Posts: 1

Rep: Reputation: Disabled
Quote:
Originally Posted by basudebg View Post
I open a disk using
int f= open(devicename,O_RDWR);
then I want to seek to a position. Here it is 0( could be anything).
lseek(f,0,SEEK_SET);

After this I want to write something. The device name is /dev/sdc ( a disk, it could be sda, sdb anything).

But just after lseek is executed, I get a coredumped message on the command prompt.

If I omit lseek, I can go on writing and after closing, can see the data. But I need lseek. Note that lseek64 also creashes the same way.

Am I doing something silly? Please help.
Basudeb
Here, you are trying to perform lseek on Block device (sdc) which is not supported. Since Block device read/write bytes in fixed size blocks. where as character device read/write bytes in a stream. Hence lseek can be performed only on character device.
 
Old 06-25-2012, 12:16 AM   #22
basudebg
LQ Newbie
 
Registered: May 2012
Posts: 25

Original Poster
Rep: Reputation: Disabled
I have just completed lseek and write on a block device and verified. So, it works, but not with wxWidget, but by using dlopen and dlsym.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
External hard disk and flash disk and Sound do not function on Sun Ray 270 thin cl ssemajose Linux - Newbie 1 05-31-2011 04:38 AM
basic program installation as applied to Wireless using Ubuntu Kitzelmcnickt Linux - Newbie 3 02-13-2009 11:02 AM
problem with lseek crash88 Programming 2 07-08-2006 07:54 PM
C function to execute a program and return the output of the program ryan.n Programming 4 08-14-2004 10:11 PM
wine crashes on 16-bit program open/close StuP Linux - Software 0 06-06-2004 01:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 03:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration