/proc/의 인코딩/cmdline 파일

/proc/의 인코딩/cmdline 파일

이 파일을 사용하려고 하는데 /proc/<pid>/cmdline파일 인코딩에 대한 문서를 찾을 수 없습니다. 내가 찾을 수 있는 유일한 정보는 매뉴얼 페이지에 있습니다.

 /proc/[pid]/cmdline
    This holds the complete command line for the process, unless the process is a zombie.  In the  latter
    case, there is nothing in this file: that is, a read on this file will return 0 characters.  The com‐
    mand-line arguments appear in this file as a set of strings separated by null bytes  ('\0'),  with  a
    further null byte after the last string.

cmdline 파일의 인코딩은 무엇입니까?

답변1

명령줄 인수는 이 파일에 널 바이트('\0')로 구분된 문자열 세트로 표시되며 마지막 문자열 뒤에는 널 바이트가 옵니다.

그게 당신이 필요한 전부입니다. 널 바이트로 구분된 명령과 해당 인수를 얻었습니다 \0. 문자의 인코딩은 을 기반으로 locale하지만 이는 중요하지 않습니다.

도움이 필요한 구체적인 예가 있나요?

관련 정보