psinfo_t solaris does not contain full process name in its field

后端 未结 2 1877
刺人心
刺人心 2021-01-25 02:23

Not getting full process name in psinfo_t struct\'s field pr_fname while reading process info from psinfo data file(/proc/%d/psinfo) into struct psinfo_t from procfs.h in solari

相关标签:
2条回答
  • 2021-01-25 02:44

    Solaris 11.3 SRU 5 introduced /proc/<pid>/execname which contains the full command name, so you can check to see if that file exists and use it if so, else fall back to the limited pr_fname.

    See Solaris 11.3 SRU 5.6: updates in ps(1) and /proc/<pid>/{cmdline,environ,execname} for details.

    0 讨论(0)
  • 2021-01-25 02:46

    The pr_fname field of the psinfo_t structure is 16 bytes long, per the source code:

    #define PRFNSZ      16  /* Maximum size of execed filename */
    

    So it will in fact be truncated to a maximum of 15 characters.

    You can get the the name of the actual binary file from /proc/PID/map. For a 32-bit process the exec'd binary will be mapped at address 0x00010000.

    You can browse the source code for ps at http://src.illumos.org/source/xref/illumos-gate/usr/src/cmd/ps/ if you want to see where it finds its data.

    0 讨论(0)
提交回复
热议问题