Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 168733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T12:30:19+00:00 2026-05-11T12:30:19+00:00

I have a question: Is there some way to the SPID in linux 2.6

  • 0

I have a question: Is there some way to the SPID in linux 2.6 from a C++ application? When I do a ‘ps -amT’ I can see the threads in the process:

root@10.67.100.2:~# ps -amT   PID  SPID TTY          TIME CMD  1120     - pts/1    00:00:20 sncmdd     -  1120 -        00:00:00 -     -  1125 -        00:00:00 -     -  1126 -        00:00:00 -     -  1128 -        00:00:00 -     -  1129 -        00:00:09 -     -  1130 -        00:00:00 -     -  1131 -        00:00:09 -  1122     - pts/1    00:00:00 snstatusdemuxd     -  1122 -        00:00:00 -     -  1127 -        00:00:00 -     -  1132 -        00:00:00 -     -  1133 -        00:00:00 - 

And then in the filesystem I can see the threads:

root@10.67.100.2:~# ls /proc/1120/task/ 1120  1125  1126  1128  1129  1130  1131 

So is there some way I can get the SPID from my application so I can somehow identify what my SPID is in each running thread?

Thanks!

/Mike

Edit: I should add that the PID returned from getpid() is the same in each thread.

When I add this code to my threads:

// Log thread information to syslog syslog(LOG_NOTICE, 'ibnhwsuperv: gettid()= %ld,  pthread_self()=%ld', (long int)syscall(224), pthread_self()); 

I get this result:

Jan  1 01:24:13 10 ibnhwsupervd[1303]: ibnhwsuperv: gettid()= -1,  pthread_self()=839027488 

Neither of which look like the SPID given by ps or in the proc filesystem.

Also, note that gettid does not return the SPID.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T12:30:20+00:00Added an answer on May 11, 2026 at 12:30 pm

    How about gettid()?

    Edit: If your libc doesn’t have the gettid() function, you should run it like this:

    #include <sys/syscall.h> syscall(SYS_gettid); 

    … or see example on this manual page.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a question about SqlDataReader: Is there some way to modificated the values
Question: Is there some way to shush up Instruments from warning about changes on
I have this question, just in theory. I do some query results and there
i have a question ( i am learning VB) is there is a way
There have been some similar questions asked regarding Grid views, but none have been
I know there have been some similar questions to this, but they haven't helped
There might be similar questions but I still have some parts that I couldn't
I have Question and QuestionTypes. In Question table there is a foreign key that
I have a question about why there is such a difference in speed between
I have a job interview tomorrow and I'm trying to answer this question: There

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.