diff options
author | newton <newton@FreeBSD.org> | 1999-02-04 12:42:39 +0000 |
---|---|---|
committer | newton <newton@FreeBSD.org> | 1999-02-04 12:42:39 +0000 |
commit | 6266a87e013823a79533aeaa77655454999cfed8 (patch) | |
tree | 503f5a04fac06233ec379264a24bd16c64e8396e | |
parent | a14ff10255d2dd0da8153e082f6d999b9388970d (diff) | |
download | FreeBSD-src-6266a87e013823a79533aeaa77655454999cfed8.zip FreeBSD-src-6266a87e013823a79533aeaa77655454999cfed8.tar.gz |
Provide elf_brand_inuse() as a method an emulator can use to find out
whether it is currently in use (which is kinda useful when it's about
to unload itself: Lockups are never very much fun, are they?).
-rw-r--r-- | sys/kern/imgact_elf.c | 15 | ||||
-rw-r--r-- | sys/sys/imgact_elf.h | 3 |
2 files changed, 16 insertions, 2 deletions
diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index 98613d8..4bc0fac 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -26,7 +26,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: imgact_elf.c,v 1.46 1999/01/27 21:49:55 dillon Exp $ + * $Id: imgact_elf.c,v 1.47 1999/01/29 22:59:43 dillon Exp $ */ #include "opt_rlimit.h" @@ -145,6 +145,19 @@ elf_remove_brand_entry(Elf_Brandinfo *entry) return 0; } +int +elf_brand_inuse(Elf_Brandinfo *entry) +{ + struct proc *p; + + for (p = allproc.lh_first; p != 0; p = p->p_list.le_next) { + if (p->p_sysent == entry->sysvec) + return TRUE; + } + + return FALSE; +} + static int elf_check_header(const Elf_Ehdr *hdr, int type) { diff --git a/sys/sys/imgact_elf.h b/sys/sys/imgact_elf.h index d841a39..e7985ce 100644 --- a/sys/sys/imgact_elf.h +++ b/sys/sys/imgact_elf.h @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: imgact_elf.h,v 1.9 1998/09/14 05:36:51 jdp Exp $ + * $Id: imgact_elf.h,v 1.10 1999/01/01 14:30:11 bde Exp $ */ #ifndef _SYS_IMGACT_ELF_H_ @@ -66,6 +66,7 @@ typedef struct { int elf_insert_brand_entry __P((Elf32_Brandinfo *entry)); int elf_remove_brand_entry __P((Elf32_Brandinfo *entry)); +int elf_brand_inuse __P((Elf32_Brandinfo *entry)); #else /* !(ELF_TARG_CLASS == ELFCLASS32) */ |