hi everybody. I have a little problem with "umount": in a piece of software i try to mount a flash device to the file system of my computer, then write/read data from/to this flash device( with fstream, each open method has its corresponding close method). The problem is that as soon as I try to umount(*char_mountpoint) I get an error 16:
EBUSY 16 /* Device or resource busy */
After cancelling the process in terminal with "Ctl+C" I can umount the device wit "umount mountpoint". Does anyone have an idea why it does not work in the c++-program?
I assumed, that the problem was in my file operations code, but after i comment the whole file operations (doing only mount and umount) the problem is still there.
It looks like your OS isn't letting you unmount because it thinks your program is still using the device. Make sure all activity has actually stopped on the device, as it could still be reading/writing from cache (look for LED activity on the flash if it has any).
If that isn't the case you can try to force an unmount with elevated privileges or lower permissions on the device itself.
¿shouldn't umount("/dev/mtd4") be umount("/tmp/fls/") ?
¿Which OS are you using?
The original umount() function was called as umount(device)
and would return ENOTBLK when called with something other than a block device.
In Linux 0.98p4 a call umount(dir) was added, in order to support anonymous devices.
In Linux 2.3.99-pre7 the call umount(device) was removed, leaving only umount(dir)