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

  • Home
  • SEARCH
  • 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

Question Is there a way to have a method that will always run anytime
I have a simple question. Is there a way ( using reflections I suppose
There have been some questions about whether or not JavaScript is an object-oriented language.
We have the question is there a performance difference between i++ and ++i in
I have seen this question: Are there any decent UI components for touch screen
I have a question about this question . I posted a reply there but
There is a question I have been wondering about for ages and I was
I have a simple question about Java's XML API and I hope there's a
Question: Does Informix have a construct equivalent to Oracle's materialized view or is there
I know there have been questions in the past about SQL 2005 versus Lucene.NET

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.