| 1 | @findex bfd_get_mtime
|
|---|
| 2 | @subsubsection @code{bfd_get_mtime}
|
|---|
| 3 | @strong{Synopsis}
|
|---|
| 4 | @example
|
|---|
| 5 | long bfd_get_mtime(bfd *abfd);
|
|---|
| 6 | @end example
|
|---|
| 7 | @strong{Description}@*
|
|---|
| 8 | Return the file modification time (as read from the file system, or
|
|---|
| 9 | from the archive header for archive members).
|
|---|
| 10 |
|
|---|
| 11 | @findex bfd_get_size
|
|---|
| 12 | @subsubsection @code{bfd_get_size}
|
|---|
| 13 | @strong{Synopsis}
|
|---|
| 14 | @example
|
|---|
| 15 | long bfd_get_size(bfd *abfd);
|
|---|
| 16 | @end example
|
|---|
| 17 | @strong{Description}@*
|
|---|
| 18 | Return the file size (as read from file system) for the file
|
|---|
| 19 | associated with BFD @var{abfd}.
|
|---|
| 20 |
|
|---|
| 21 | The initial motivation for, and use of, this routine is not
|
|---|
| 22 | so we can get the exact size of the object the BFD applies to, since
|
|---|
| 23 | that might not be generally possible (archive members for example).
|
|---|
| 24 | It would be ideal if someone could eventually modify
|
|---|
| 25 | it so that such results were guaranteed.
|
|---|
| 26 |
|
|---|
| 27 | Instead, we want to ask questions like "is this NNN byte sized
|
|---|
| 28 | object I'm about to try read from file offset YYY reasonable?"
|
|---|
| 29 | As as example of where we might do this, some object formats
|
|---|
| 30 | use string tables for which the first @code{sizeof (long)} bytes of the
|
|---|
| 31 | table contain the size of the table itself, including the size bytes.
|
|---|
| 32 | If an application tries to read what it thinks is one of these
|
|---|
| 33 | string tables, without some way to validate the size, and for
|
|---|
| 34 | some reason the size is wrong (byte swapping error, wrong location
|
|---|
| 35 | for the string table, etc.), the only clue is likely to be a read
|
|---|
| 36 | error when it tries to read the table, or a "virtual memory
|
|---|
| 37 | exhausted" error when it tries to allocate 15 bazillon bytes
|
|---|
| 38 | of space for the 15 bazillon byte table it is about to read.
|
|---|
| 39 | This function at least allows us to answer the quesion, "is the
|
|---|
| 40 | size reasonable?".
|
|---|
| 41 |
|
|---|