diff options
author | Alan Modra <amodra@gmail.com> | 2006-12-15 04:13:37 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2006-12-15 04:13:37 +0000 |
commit | f6cf9273b303df38238008c8be44bed4633afd9c (patch) | |
tree | 91b65ac703c8efef824bcd61eb79d22f8e56f3af /bfd/opncls.c | |
parent | 263c8770d6f3270eefa6c7ac6d603b9d8882898f (diff) | |
download | gdb-f6cf9273b303df38238008c8be44bed4633afd9c.zip gdb-f6cf9273b303df38238008c8be44bed4633afd9c.tar.gz gdb-f6cf9273b303df38238008c8be44bed4633afd9c.tar.bz2 |
bfd/
* opncls.c (bfd_openr_iovec): Add "stat" parameter.
(struct opncls): Add "stat" field.
(opncls_bstat): Call vec->stat.
* bfd-in2.h: Regenerate.
* elf32-spu.c (spu_elf_open_builtin_lib): Adjust.
gdb/
* spu-linux-nat.c (spu_bfd_iovec_stat): New function.
(spu_bfd_open): Adjust bfd_openr_iovec call.
Diffstat (limited to 'bfd/opncls.c')
-rw-r--r-- | bfd/opncls.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/bfd/opncls.c b/bfd/opncls.c index 4131f9d..4002f5f 100644 --- a/bfd/opncls.c +++ b/bfd/opncls.c @@ -384,7 +384,10 @@ SYNOPSIS file_ptr nbytes, file_ptr offset), int (*close) (struct bfd *nbfd, - void *stream)); + void *stream), + int (*stat) (struct bfd *abfd, + void *stream, + struct stat *sb)); DESCRIPTION @@ -411,6 +414,10 @@ DESCRIPTION <<bfd_close>>. @var{close} either succeeds returning 0, or fails returning -1 (setting <<bfd_error>>). + Calls @var{stat} to fill in a stat structure for bfd_stat, + bfd_get_size, and bfd_get_mtime calls. @var{stat} returns 0 + on success, or returns -1 on failure (setting <<bfd_error>>). + If <<bfd_openr_iovec>> returns <<NULL>> then an error has occurred. Possible errors are <<bfd_error_no_memory>>, <<bfd_error_invalid_target>> and <<bfd_error_system_call>>. @@ -423,6 +430,7 @@ struct opncls file_ptr (*pread) (struct bfd *abfd, void *stream, void *buf, file_ptr nbytes, file_ptr offset); int (*close) (struct bfd *abfd, void *stream); + int (*stat) (struct bfd *abfd, void *stream, struct stat *sb); file_ptr where; }; @@ -485,10 +493,15 @@ opncls_bflush (struct bfd *abfd ATTRIBUTE_UNUSED) } static int -opncls_bstat (struct bfd *abfd ATTRIBUTE_UNUSED, struct stat *sb) +opncls_bstat (struct bfd *abfd, struct stat *sb) { + struct opncls *vec = abfd->iostream; + memset (sb, 0, sizeof (*sb)); - return 0; + if (vec->stat == NULL) + return 0; + + return (vec->stat) (abfd, vec->stream, sb); } static const struct bfd_iovec opncls_iovec = { @@ -507,7 +520,10 @@ bfd_openr_iovec (const char *filename, const char *target, file_ptr nbytes, file_ptr offset), int (*close) (struct bfd *nbfd, - void *stream)) + void *stream), + int (*stat) (struct bfd *abfd, + void *stream, + struct stat *sb)) { bfd *nbfd; const bfd_target *target_vec; @@ -539,6 +555,7 @@ bfd_openr_iovec (const char *filename, const char *target, vec->stream = stream; vec->pread = pread; vec->close = close; + vec->stat = stat; nbfd->iovec = &opncls_iovec; nbfd->iostream = vec; |