View Source os_process (os_process v1.0.0)

Summary

Functions

Return map with OS-specific information about current process.

Return sizes (in bits) of the primitive values for a given system.

Functions

info()

-spec info() -> #{pid => pos_integer(), priority => map(), atom() := term()}.

Return map with OS-specific information about current process.

On UNIX-like OSes the map will contain:

  • pid - process ID for the VM, returned value should be logically the same as os:getpid/0, however it will be integer instead of string there.

    For more information see man 2 getpid.
  • priority - map containing priorities for given process. It will contain 3 keys:
    • process
    • process_group
    • user
    For more info see man 2 getpriority.
  • pgid - process group ID.

    For more info see man 2 getpgid.
  • parent_pid - process ID of the parent process.

    For more info see man 2 getppid.
  • uid - user ID.

    For more info see man 2 getuid.
  • gid - group ID.

    For more info see man 2 getgid.
  • effective_uid - effective user ID.

    For more info see man 2 geteuid.
  • effective_gid - effective group ID.

    For more info see man 2 getegid.

On Windows it will contain:

  • pid - process ID for the VM, returned value should be logically the same as os:getpid/0, however it will be integer instead of string there.
  • priority - map containing priorities for given process. It will contain 3 keys:
    • class
    • thread
  • user_name - name of the owner of the process as binary.

sizes()

-spec sizes() ->
               #{byte => pos_integer(),
                 int => pos_integer(),
                 long => pos_integer(),
                 long_long => pos_integer(),
                 ptr => pos_integer()}.

Return sizes (in bits) of the primitive values for a given system.

  • byte - amount of bits in a byte, where byte is defined as minimal addressable piece of the memory.
  • int - amount of bits in int C type.
  • long - amount of bits in long C type.
  • long_long - amount of bits in long long C type.
  • ptr - amount of bits in C pointer type.