diff options
-rw-r--r-- | include/ChangeLog | 4 | ||||
-rw-r--r-- | include/ctf-api.h | 1 | ||||
-rw-r--r-- | libctf/ChangeLog | 5 | ||||
-rw-r--r-- | libctf/ctf-open.c | 11 | ||||
-rw-r--r-- | libctf/libctf.ver | 1 |
5 files changed, 22 insertions, 0 deletions
diff --git a/include/ChangeLog b/include/ChangeLog index dd9d5e0..3e3bb0a 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,5 +1,9 @@ 2020-07-22 Nick Alcock <nick.alcock@oracle.com> + * ctf-api.h (ctf_ref): New. + +2020-07-22 Nick Alcock <nick.alcock@oracle.com> + * ctf-api.h (ctf_archive_count): New. 2020-07-22 Nick Alcock <nick.alcock@oracle.com> diff --git a/include/ctf-api.h b/include/ctf-api.h index fb797a3..faa7b72 100644 --- a/include/ctf-api.h +++ b/include/ctf-api.h @@ -285,6 +285,7 @@ extern ctf_file_t *ctf_simple_open (const char *, size_t, const char *, size_t, size_t, const char *, size_t, int *); extern ctf_file_t *ctf_bufopen (const ctf_sect_t *, const ctf_sect_t *, const ctf_sect_t *, int *); +extern void ctf_ref (ctf_file_t *); extern void ctf_file_close (ctf_file_t *); extern int ctf_arc_write (const char *, ctf_file_t **, size_t, diff --git a/libctf/ChangeLog b/libctf/ChangeLog index c22cba0..84f82fa 100644 --- a/libctf/ChangeLog +++ b/libctf/ChangeLog @@ -1,5 +1,10 @@ 2020-07-22 Nick Alcock <nick.alcock@oracle.com> + * libctf.ver (ctf_ref): New. + * ctf-open.c (ctf_ref): Implement it. + +2020-07-22 Nick Alcock <nick.alcock@oracle.com> + * ctf-inlines.h (ctf_forwardable_kind): New. * ctf-create.c (ctf_add_forward): Use it. diff --git a/libctf/ctf-open.c b/libctf/ctf-open.c index 05672f3..b7846bd 100644 --- a/libctf/ctf-open.c +++ b/libctf/ctf-open.c @@ -1620,6 +1620,17 @@ bad: return NULL; } +/* Bump the refcount on the specified CTF container, to allow export of + ctf_file_t's from iterators that open and close the ctf_file_t around the + loop. (This does not extend their lifetime beyond that of the ctf_archive_t + in which they are contained.) */ + +void +ctf_ref (ctf_file_t *fp) +{ + fp->ctf_refcnt++; +} + /* Close the specified CTF container and free associated data structures. Note that ctf_file_close() is a reference counted operation: if the specified file is the parent of other active containers, its reference count will be greater diff --git a/libctf/libctf.ver b/libctf/libctf.ver index 375dee8..93616d8 100644 --- a/libctf/libctf.ver +++ b/libctf/libctf.ver @@ -24,6 +24,7 @@ LIBCTF_1.0 { ctf_simple_open; ctf_create; ctf_close; + ctf_ref; ctf_file_close; ctf_cuname; |