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 8718719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:36:53+00:00 2026-06-13T06:36:53+00:00

I have a structure defined in /usr/src/linux-3.2/include/linux/unistd.h of the linux kernel: #ifndef _LINUX_UNISTD_H_ #define

  • 0

I have a structure defined in /usr/src/linux-3.2/include/linux/unistd.h of the linux kernel:

#ifndef _LINUX_UNISTD_H_
#define _LINUX_UNISTD_H_

struct threadinfo_struct {
    int pid;
    int nthreads;
    int *tid;
};

/*
 * Include machine specific syscall numbers
 */
#include <asm/unistd.h>

#endif /* _LINUX_UNISTD_H_ */

After compiling and installing the kernel, then booting from it, I try to compile and run this program:

#include <stdio.h>
#include <linux/unistd.h>
int main(void) {
    struct threadinfo_struct *ti = (struct threadinfo_struct*) malloc(sizeof(struct threadinfo_struct));
    // ...
    return 0;
}

However, when I try and do this, I get an error in compilation of the program:

test.c: In function 'main':
test.c:4:78: error: invalid application of 'sizeof' to incomplete type 'struct threadinfo_struct'

Why am I getting this error, and how can I resolve it? This is difficult for me to find much information, given that I am very new to the linux kernel.

  • 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. Editorial Team
    Editorial Team
    2026-06-13T06:36:55+00:00Added an answer on June 13, 2026 at 6:36 am

    The file /usr/src/linux-3.2/include/linux/unistd.h is not on a standard include path.

    The user-space applications have their own build environment. You are including the file that is located at /usr/include/linux/unistd.h. Most of the internal kernel structures are not defined for user-space applications.

    If you really need this structure to be defined then you need to copy the file from the linux tree to your project directory, or adjust the gcc command by adding the -isystem/usr/src/linux-3.2/include/ option.

    However, the latter will create a big mess, so better just copy the file.

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

Sidebar

Related Questions

I have a structure defined like so: typedef struct { int n; int *n_p;
I have a structure defined as struct xyz { char *str; int x; int
I have program, that has structure defined like this: struct foo { int magic;
I have structure declaration in a header globalStruct.h #ifndef _GLOBALSTRUCT_H #define _GLOBALSTRUCT_H typedef struct
I have a data structure defined as struct myDataStruct { int32_t header; int16_t data[8];
I have a structure defined in my header file: struct video { wchar_t* videoName;
I have a structure defined in IDL. This structure has following members: { BSTR
I have a structure which aims at storing user defined data (i.e. from a
I have created a JSF 2 page which uses Facelets to define the structure
I have a structure like this struct structure { BaseObject &A; //BaseObject has a

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.