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?).
This commit is contained in:
newton 1999-02-04 12:42:39 +00:00
parent 6389f53b37
commit 4e50258e0c
2 changed files with 16 additions and 2 deletions

View File

@ -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)
{

View File

@ -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) */