返回由当前进程相关的补充组ID构成的列表。
适用于: Unix.
注
On Mac OS X, getgroups() behavior differs somewhat from other Unix platforms. If the Python interpreter was built with a deployment target of 10.5 or earlier, getgroups() returns the list of effective group ids associated with the current user process; this list is limited to a system-defined number of entries, typically 16, and may be modified by calls to setgroups() if suitably privileged. If built with a deployment target greater than 10.5, getgroups() returns the current group access list for the user associated with the effective user id of the process; the group access list may change over the lifetime of the process, it is not affected by calls to setgroups(), and its length is not limited to 16. The deployment target value,MACOSX_DEPLOYMENT_TARGET, can be obtained with sysconfig.get_config_var().
os.initgroups(username, gid)
调用系统的 initgroups() 来初始化那些 username 是其成员的组的组访问列表,以及指定组ID对应的组访问列表。
适用于: Unix.
New in version 2.7.
返回参数 pid 指定进程所在的进程组ID,如果 pid 是0, 当前进程所在的进程组ID将被返回。
适用于: Unix.
New in version 2.3.
os.getpgrp()
返回当前进程组的ID。
适用于: Unix.
os.getpid()
返回当前进程ID
适用于: Unix, Windows.
os.getppid()
返回父进程ID
适用于: Unix.
os.getresuid()
返回一个元组—— (ruid, euid, suid) ,分别代表当前进程的真实、有效和保存的(saved)用户ID。
适用于: Unix.
New in version 2.7.
os.getresgid()
返回一个元组—— (rgid, egid, sgid) 分别代表当前进程的真实、有效和保存的(saved)组ID。
适用于: Unix.
New in version 2.7.
os.getuid()
返回当前进程的真实用户ID
适用于: Unix.
os.getenv(varname[, value])
如果存在,就返回环境变量 varname 的值;如果不存在,就返回 value , value 缺省为 None。
适用于: most flavors of Unix, Windows.
os.putenv(varname, value)
将环境变量 varname 设置为 value。 这样的改变会影响以os.system(), popen() or fork() and execv() 开始的子进程。
适用于: most flavors of Unix, Windows. 注
在某些平台上,包括 FreeBSD 和 Mac OS X,设置 environ 可能会造成内存泄露,请参考具体系统对于 putenv 的文档。
当支持 putenv() 时,对 os.environ 中元素的赋值会自动转化为调用 putenv()。但是调用 putenv() 不会更新 os.environ。
os.setegid(egid)
设置当前进程的有效组ID。
适用于: Unix.
os.seteuid(euid)
设置当前进程的有效用户ID
适用于: Unix.
os.setgid(gid)
设置当前进程的组ID
适用于: Unix.
os.setgroups(groups)
将当前进程的补充组ID设置为参数 groups. groups 必须是一个 sequence,每一个元素必须是指示一个组的整数。这个操作通常只有超级用户可以使用。
适用于: Unix.
New in version 2.2. 注
On Mac OS X, the length of groups may not exceed the system-defined maximum number of effective group ids, typically 16. See the documentation for getgroups() for cases where it may not return the same group list set by calling setgroups().