aboutsummaryrefslogtreecommitdiff
path: root/gold/output.h
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2009-09-01 17:32:20 +0000
committerIan Lance Taylor <ian@airs.com>2009-09-01 17:32:20 +0000
commit404c2abb01aeb1f5434d613036ee101bf256e57a (patch)
treec8d1bf552ee41252547ee4f949775c67ad5ac83c /gold/output.h
parent77495bbfbf6b24069a0a541005fa5c9dda2efd4f (diff)
downloadgdb-404c2abb01aeb1f5434d613036ee101bf256e57a.zip
gdb-404c2abb01aeb1f5434d613036ee101bf256e57a.tar.gz
gdb-404c2abb01aeb1f5434d613036ee101bf256e57a.tar.bz2
* output.cc (Output_file::open_for_modification): New method.
(Output_file::map_anonymous): Changed return type to bool. Record map in base_ field. (Output_file::map_no_anonymous): New method, broken out of map. (Output_file::map): Use map_no_anonymous and map_anonymous. * output.h (class Output_file): Update declarations.
Diffstat (limited to 'gold/output.h')
-rw-r--r--gold/output.h21
1 files changed, 17 insertions, 4 deletions
diff --git a/gold/output.h b/gold/output.h
index f9cbfa6..7bd0cf3 100644
--- a/gold/output.h
+++ b/gold/output.h
@@ -3093,16 +3093,24 @@ class Output_file
set_is_temporary()
{ this->is_temporary_ = true; }
+ // Try to open an existing file. Returns false if the file doesn't
+ // exist, has a size of 0 or can't be mmaped. This method is
+ // thread-unsafe.
+ bool
+ open_for_modification();
+
// Open the output file. FILE_SIZE is the final size of the file.
+ // If the file already exists, it is deleted/truncated. This method
+ // is thread-unsafe.
void
open(off_t file_size);
- // Resize the output file.
+ // Resize the output file. This method is thread-unsafe.
void
resize(off_t file_size);
// Close the output file (flushing all buffered data) and make sure
- // there are no errors.
+ // there are no errors. This method is thread-unsafe.
void
close();
@@ -3153,14 +3161,19 @@ class Output_file
{ }
private:
- // Map the file into memory.
+ // Map the file into memory or, if that fails, allocate anonymous
+ // memory.
void
map();
// Allocate anonymous memory for the file.
- void*
+ bool
map_anonymous();
+ // Map the file into memory.
+ bool
+ map_no_anonymous();
+
// Unmap the file from memory (and flush to disk buffers).
void
unmap();