Opened 3 years ago

Closed 3 years ago

#17723 closed bug (duplicate)

getpid() return wrong value if called in image initalizer before main()

Reported by: X512 Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: System/libroot.so Version: R1/Development
Keywords: Cc:
Blocked By: #11797 Blocking:
Platform: All

Description

This is hrev56010.

Test code:

#include <stdio.h>
#include <unistd.h>


struct Init {
    Init()
    {
        printf("Init\n");
        printf("getpid(): %d\n", getpid());
    }
} gInit;


int main()
{
    printf("main\n");
    printf("getpid(): %d\n", getpid());
    return 0;
}

Actual result:

Init
getpid(): 0
main
getpid(): 2819

Expected result:

Init
getpid(): 2819
main
getpid(): 2819

Change History (1)

comment:1 by korli, 3 years ago

Blocked By: 11797 added
Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.