task_struct pid in for current task does not tally ..

From: Basith Salman (basithsalman_at_mindspring.com)
Date: 01/31/04

  • Next message: Anthony E. Greene: "Re: Circumventing PAM"
    To: <redhat-list@redhat.com>
    Date: Fri, 30 Jan 2004 21:32:36 -0800
    
    

    Hi All,

    The current->pid of the task_struct does not tall with the getpid()
    for pthread_create() call.

    For ex. below the getpid() in myfunc() does not tally with the
    pid in the current task_struct for linux redhat 9.
    It is one more that the in thread func.
    ex. if getpid() below return 100 than the current->pid of the
    task_struct (sched.) has a value of 101.
    If this is the case than how do I get the actual thread
    pid from the task_struc in ther kernel.

    TIA
    basithsalman@mindspring.com
    main()
    {
        ...
       pthread_create(tid, myfunc, ..);
    }

    myfunc()
    {
        getpid();
    }

    -- 
    redhat-list mailing list
    unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe
    https://www.redhat.com/mailman/listinfo/redhat-list
    

  • Next message: Anthony E. Greene: "Re: Circumventing PAM"

    Relevant Pages

    • Re: Is fork() hook ever possible?
      ... child's pid is needed. ... Currently OpenBSD does almost that checking getpid() every time ... application, we have standard API only - fork() and arc4randomfamily, ... This wouldn't work if the application made its own syscall ...
      (freebsd-current)
    • [patch 1/1] uml: use sys_getpid bypassing glibc (fixes UML on Gentoo)
      ... Using NPTL, getpid() sometimes delivers the wrong pid, since it uses the one ... int is_skas_winch ... printf("sigaltstack failed - errno = %d\n", ...
      (Linux-Kernel)
    • Re: Starting an external application from C++
      ... The getpid() system call returns both the current PID and the ... Basically the parent application is a client app which spawns the server, ... I'm not calling system(). ...
      (comp.unix.programmer)
    • Re: clone() <-> getpid() bug in 2.6?
      ... So yes, you'll find some broken benchmarks using getpid(), but nobody sane ... thread-specific pid to look up the thread-specific data. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [HACKERS] semaphore usage "port based"?
      ... So any pid returned here is necessarily stale -- even if there ... If the PID returned by GETPID is ... then we assume that the semaphore set can be recycled. ... semaphore sets, even if you've got lots of postmaster crashes going on ...
      (freebsd-stable)