mirror of
https://github.com/verilator/verilator.git
synced 2026-10-07 18:42:58 +02:00
Remove slow sync() call for NFS flushing.
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include <cctype>
|
||||
#include <dirent.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <set>
|
||||
#include <list>
|
||||
#include <map>
|
||||
@@ -277,6 +278,17 @@ bool V3Options::fileStatNormal(const string& filename) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void V3Options::fileNfsFlush(const string& filename) {
|
||||
// NFS caches stat() calls so to get up-to-date information must
|
||||
// do a open or opendir on the filename.
|
||||
// Faster to just try both rather than check if a file is a dir.
|
||||
if (DIR* dirp = opendir(filename.c_str())) {
|
||||
closedir(dirp);
|
||||
} else if (int fd = ::open(filename.c_str(), O_RDONLY)) {
|
||||
if (fd>0) ::close(fd);
|
||||
}
|
||||
}
|
||||
|
||||
string V3Options::fileExists (const string& filename) {
|
||||
// Surprisingly, for VCS and other simulators, this process
|
||||
// is quite slow; presumably because of re-reading each directory
|
||||
|
||||
Reference in New Issue
Block a user