LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Pthreads + forking to run files (https://www.linuxquestions.org/questions/linux-software-2/pthreads-forking-to-run-files-142252/)

flakjacket 02-04-2004 01:03 PM

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?

jtshaw 02-04-2004 01:26 PM

You want supermount if you want to be able to automatically mount removable file systems.

flakjacket 02-04-2004 02:08 PM

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.


All times are GMT -5. The time now is 02:00 AM.