Skip to content

Commit

Permalink
Fix shmem file sizes to be 64-bit on all platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
rocallahan committed Oct 22, 2015
1 parent 29c563e commit 9b624d4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/EmuFs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ void EmuFs::gc(const Session& session) {
}

EmuFile::shr_ptr EmuFs::get_or_create(const KernelMapping& recorded_km,
size_t file_size) {
uint64_t file_size) {
FileId id(recorded_km);
auto it = files.find(id);
if (it != files.end()) {
Expand Down
8 changes: 4 additions & 4 deletions src/EmuFs.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class EmuFile {
friend class EmuFs;

EmuFile(ScopedFd&& fd, const std::string& orig_path, dev_t device,
ino_t inode, size_t file_size);
ino_t inode, uint64_t file_size);

/**
* Return a copy of this file. See |create()| for the meaning
Expand Down Expand Up @@ -113,11 +113,11 @@ class EmuFile {
* might exist concurrently in this tracer process.
*/
static shr_ptr create(const std::string& orig_path, dev_t orig_device,
ino_t orig_inode, size_t orig_file_size);
ino_t orig_inode, uint64_t orig_file_size);

std::string orig_path;
ScopedFd file;
size_t size_;
uint64_t size_;
dev_t device_;
ino_t inode_;
bool is_marked;
Expand Down Expand Up @@ -150,7 +150,7 @@ class EmuFs {
* |recorded_km|.
*/
EmuFile::shr_ptr get_or_create(const KernelMapping& recorded_km,
size_t file_size);
uint64_t file_size);

/**
* Dump information about this emufs to the "error" log.
Expand Down
4 changes: 2 additions & 2 deletions src/util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ bool should_copy_mmap_region(const string& file_name, const struct stat* stat,
return true;
}

ScopedFd create_shmem_segment(const string& name, size_t num_bytes) {
ScopedFd create_shmem_segment(const string& name, uint64_t num_bytes) {
char path[PATH_MAX];
snprintf(path, sizeof(path) - 1, "%s/%s", SHMEM_FS, name.c_str());

Expand All @@ -580,7 +580,7 @@ ScopedFd create_shmem_segment(const string& name, size_t num_bytes) {
return fd;
}

void resize_shmem_segment(ScopedFd& fd, size_t num_bytes) {
void resize_shmem_segment(ScopedFd& fd, uint64_t num_bytes) {
if (ftruncate(fd, num_bytes)) {
FATAL() << "Failed to resize shmem to " << num_bytes;
}
Expand Down
4 changes: 2 additions & 2 deletions src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,13 @@ bool should_copy_mmap_region(const std::string& filename,
* Return an fd referring to a new shmem segment with descriptive
* |name| of size |num_bytes|.
*/
ScopedFd create_shmem_segment(const std::string& name, size_t num_bytes);
ScopedFd create_shmem_segment(const std::string& name, uint64_t num_bytes);

/**
* Ensure that the shmem segment referred to by |fd| has exactly the
* size |num_bytes|.
*/
void resize_shmem_segment(ScopedFd& fd, size_t num_bytes);
void resize_shmem_segment(ScopedFd& fd, uint64_t num_bytes);

enum cpuid_requests {
CPUID_GETVENDORSTRING,
Expand Down

0 comments on commit 9b624d4

Please sign in to comment.