函数源码

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source File:fs\binfmt_misc.c Create Date:2022-07-29 11:02:11
首页 Copyright©Brick

546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
/* generic stuff */
 
static void entry_status(Node *e, char *page)
{
    char *dp = page;
    const char *status = "disabled";
 
    if (test_bit(Enabled, &e->flags))
        status = "enabled";
 
    if (!VERBOSE_STATUS) {
        sprintf(page, "%s\n", status);
        return;
    }
 
    dp += sprintf(dp, "%s\ninterpreter %s\n", status, e->interpreter);
 
    /* print the special flags */
    dp += sprintf(dp, "flags: ");
    if (e->flags & MISC_FMT_PRESERVE_ARGV0)
        *dp++ = 'P';
    if (e->flags & MISC_FMT_OPEN_BINARY)
        *dp++ = 'O';
    if (e->flags & MISC_FMT_CREDENTIALS)
        *dp++ = 'C';
    if (e->flags & MISC_FMT_OPEN_FILE)
        *dp++ = 'F';
    *dp++ = '\n';
 
    if (!test_bit(Magic, &e->flags)) {
        sprintf(dp, "extension .%s\n", e->magic);
    } else {
        dp += sprintf(dp, "offset %i\nmagic ", e->offset);
        dp = bin2hex(dp, e->magic, e->size);
        if (e->mask) {
            dp += sprintf(dp, "\nmask ");
            dp = bin2hex(dp, e->mask, e->size);
        }
        *dp++ = '\n';
        *dp = '\0';
    }
}