当前位置: 技术问答>linux和unix
linux下system();函数用这用这,不能用了
来源: 互联网 发布时间:2017-01-30
本文导语: 我在程序中频繁的 system("umount /usr/local/thunder/medias/"); system("mount /dev/hda2 /usr/local/thunder/medias/"); 一保证文件被传送的正确的位子,可是一段时间大概是460次的时候,发现system()函数不执行了。 这么会事啊??? 请...
我在程序中频繁的
system("umount /usr/local/thunder/medias/");
system("mount /dev/hda2 /usr/local/thunder/medias/");
一保证文件被传送的正确的位子,可是一段时间大概是460次的时候,发现system()函数不执行了。
这么会事啊???
请高手帮忙。
system("umount /usr/local/thunder/medias/");
system("mount /dev/hda2 /usr/local/thunder/medias/");
一保证文件被传送的正确的位子,可是一段时间大概是460次的时候,发现system()函数不执行了。
这么会事啊???
请高手帮忙。
|
检查 mount 的提示信息和返回值。
|
system()->fork() or vfork(). It will cause many zombie process. And system process number is a limited number. So if you call system() many times. It will cause the system crash.
|
如果只是要同步写操作,sync 足够了……
According to the standard specification (e.g., POSIX.1-2001), sync() schedules the writes, but may return before
the actual writing is done. However, since version 1.3.20 Linux does actually wait. (This still does not guaran‐
tee data integrity: modern disks have large caches.)
自从 1.3.20 起,就已经改成等待同步结束再返回了。
According to the standard specification (e.g., POSIX.1-2001), sync() schedules the writes, but may return before
the actual writing is done. However, since version 1.3.20 Linux does actually wait. (This still does not guaran‐
tee data integrity: modern disks have large caches.)
自从 1.3.20 起,就已经改成等待同步结束再返回了。
|
try unlink().
|
jjjff
|
用Valgrind
|
study
|
学习!