LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-04-2004, 01:03 PM   #1
flakjacket
LQ Newbie
 
Registered: Sep 2003
Location: Hampshire, England
Distribution: debian
Posts: 5

Rep: Reputation: 0
Pthreads + forking to run files


I'm using Debian 2.4.18 and have a problem with mounting/unmounting USB storage devices from within an application program. I can mount/unmount the devices fine from the shell.

The program is multithreaded usign pthreads. When I try and fork a new process in which I execv the mount/unmount system call, the child process does not seem to run. Fork returns for the parent process with the valid child process id but never returns (with 0) for the child process. ps -ef shows the process id for the child as myprogram <defunct>.

If I wait for the child process to terminate from the parent process using waitpid it never returns.

If I change the program not to use pthreads it works fine.


Alternatively, is there a way to configure the USB device (dev/sda1) to auto mount and unmount when the device is plugged / unplugged?
 
Old 02-04-2004, 01:26 PM   #2
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 67
You want supermount if you want to be able to automatically mount removable file systems.
 
Old 02-04-2004, 02:08 PM   #3
flakjacket
LQ Newbie
 
Registered: Sep 2003
Location: Hampshire, England
Distribution: debian
Posts: 5

Original Poster
Rep: Reputation: 0
Thanks, will see if I can get one of the supermount patches to work with debian 2.4.18 (the docs suggest it may be possible)

I would still like to understand why pthreads and fork doesn't work as I am likely to need to do other (non mounting related) system calls from within the application.
 
  


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
Forking Related.. abhijeetudas Linux - General 2 06-09-2005 01:58 AM
Linux Forking? linuxmania Linux - Distributions 3 04-07-2005 12:59 PM
Forking is very slow jspenguin Linux - General 2 05-29-2004 02:03 PM
Forking in Unix Rv5 Linux - General 5 11-04-2003 03:27 PM
How do you decompress files, or run files such as the Netscape 6 Uninstaller in RH7.2 oudent Linux - Newbie 1 11-19-2001 12:11 AM

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

All times are GMT -5. The time now is 10:02 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