سؤال

Starting to write C code for the Linux platform, I am using man tool to get information about standard libraries functions. Now I wonder what are the solution to get easily information about the structures used by these functions.

To get an example here is the (partially) output of man sched_setaffinity

SCHED_SETAFFINITY(2)                                                                                                  Linux Programmer's Manual                                                                                                  SCHED_SETAFFINITY(2)

NAME
       sched_setaffinity, sched_getaffinity - set and get a process's CPU affinity mask

SYNOPSIS
       #define _GNU_SOURCE             /* See feature_test_macros(7) */
       #include <sched.h>

       int sched_setaffinity(pid_t pid, size_t cpusetsize,
                             cpu_set_t *mask);

I now want to do conceptually a "man cpu_set_t" to now what this structure look like.

How achieve this ? For now I am browsing the web or the header files containing the structure declaration but it's not as "quick" as I would hope. Is there any better solution ?

EDIT: I suspect this type to be an integer or long type, but I choose this example for conciseness and of course my question stands fro complex structures

هل كانت مفيدة؟

المحلول

Running man -k cpu_set (equivalent to apropos cpu_set, searches through descriptions) leads one to the man page for the CPU_SET macros, which are also referred to by the sched_setaffinity man page. (I expect you are referring more to the general case, but you should note that cpu_set_t should be treated as opaque and accessed via those macros)

In most cases, the relevant man pages do either describe the types they need directly, or refer to other relevant pages for those.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top