Line 156... |
Line 156... |
. Otherwise, a value of -1 is returned (and <<bfd_error>> is set). *}
|
. Otherwise, a value of -1 is returned (and <<bfd_error>> is set). *}
|
. int (*bseek) (struct bfd *abfd, file_ptr offset, int whence);
|
. int (*bseek) (struct bfd *abfd, file_ptr offset, int whence);
|
. int (*bclose) (struct bfd *abfd);
|
. int (*bclose) (struct bfd *abfd);
|
. int (*bflush) (struct bfd *abfd);
|
. int (*bflush) (struct bfd *abfd);
|
. int (*bstat) (struct bfd *abfd, struct stat *sb);
|
. int (*bstat) (struct bfd *abfd, struct stat *sb);
|
. {* Just like mmap: (void*)-1 on failure, mmapped address on success. *}
|
. {* Mmap a part of the files. ADDR, LEN, PROT, FLAGS and OFFSET are the usual
|
|
. mmap parameter, except that LEN and OFFSET do not need to be page
|
|
. aligned. Returns (void *)-1 on failure, mmapped address on success.
|
|
. Also write in MAP_ADDR the address of the page aligned buffer and in
|
|
. MAP_LEN the size mapped (a page multiple). Use unmap with MAP_ADDR and
|
|
. MAP_LEN to unmap. *}
|
. void *(*bmmap) (struct bfd *abfd, void *addr, bfd_size_type len,
|
. void *(*bmmap) (struct bfd *abfd, void *addr, bfd_size_type len,
|
. int prot, int flags, file_ptr offset);
|
. int prot, int flags, file_ptr offset,
|
|
. void **map_addr, bfd_size_type *map_len);
|
.};
|
.};
|
|
|
.extern const struct bfd_iovec _bfd_memory_iovec;
|
.extern const struct bfd_iovec _bfd_memory_iovec;
|
|
|
*/
|
*/
|
Line 421... |
Line 427... |
FUNCTION
|
FUNCTION
|
bfd_mmap
|
bfd_mmap
|
|
|
SYNOPSIS
|
SYNOPSIS
|
void *bfd_mmap (bfd *abfd, void *addr, bfd_size_type len,
|
void *bfd_mmap (bfd *abfd, void *addr, bfd_size_type len,
|
int prot, int flags, file_ptr offset);
|
int prot, int flags, file_ptr offset,
|
|
void **map_addr, bfd_size_type *map_len);
|
|
|
DESCRIPTION
|
DESCRIPTION
|
Return mmap()ed region of the file, if possible and implemented.
|
Return mmap()ed region of the file, if possible and implemented.
|
|
LEN and OFFSET do not need to be page aligned. The page aligned
|
|
address and length are written to MAP_ADDR and MAP_LEN.
|
|
|
*/
|
*/
|
|
|
void *
|
void *
|
bfd_mmap (bfd *abfd, void *addr, bfd_size_type len,
|
bfd_mmap (bfd *abfd, void *addr, bfd_size_type len,
|
int prot, int flags, file_ptr offset)
|
int prot, int flags, file_ptr offset,
|
|
void **map_addr, bfd_size_type *map_len)
|
{
|
{
|
void *ret = (void *)-1;
|
void *ret = (void *)-1;
|
|
|
if (abfd->iovec == NULL)
|
if (abfd->iovec == NULL)
|
return ret;
|
return ret;
|
|
|
return abfd->iovec->bmmap (abfd, addr, len, prot, flags, offset);
|
return abfd->iovec->bmmap (abfd, addr, len, prot, flags, offset,
|
|
map_addr, map_len);
|
}
|
}
|
|
|
/* Memory file I/O operations. */
|
/* Memory file I/O operations. */
|
|
|
static file_ptr
|
static file_ptr
|
Line 584... |
Line 595... |
}
|
}
|
|
|
static void *
|
static void *
|
memory_bmmap (bfd *abfd ATTRIBUTE_UNUSED, void *addr ATTRIBUTE_UNUSED,
|
memory_bmmap (bfd *abfd ATTRIBUTE_UNUSED, void *addr ATTRIBUTE_UNUSED,
|
bfd_size_type len ATTRIBUTE_UNUSED, int prot ATTRIBUTE_UNUSED,
|
bfd_size_type len ATTRIBUTE_UNUSED, int prot ATTRIBUTE_UNUSED,
|
int flags ATTRIBUTE_UNUSED, file_ptr offset ATTRIBUTE_UNUSED)
|
int flags ATTRIBUTE_UNUSED, file_ptr offset ATTRIBUTE_UNUSED,
|
|
void **map_addr ATTRIBUTE_UNUSED,
|
|
bfd_size_type *map_len ATTRIBUTE_UNUSED)
|
{
|
{
|
return (void *)-1;
|
return (void *)-1;
|
}
|
}
|
|
|
const struct bfd_iovec _bfd_memory_iovec =
|
const struct bfd_iovec _bfd_memory_iovec =
|