Let's Go

Let's Go Three

2018-11-18  本文已影响0人  zgq_70ae

Three

os.Getid() 过去当前用户所在组ID

例子 :str := os.Getid() 返回一个int
fmt.Printf("%s", str)
运行程序:
go run main.go
打印结果:
1000

os.Getegid()返回调用者的有效组ID

例子 :str := os.Geteid() 返回一个int
fmt.Printf("%s", str)
运行程序:
go run main.go
打印结果:
1000

os.Getgroups()返回调用者的有效组ID

例子 :str, _ := os.Getgroups() 返回一个int和一个错误类型
fmt.Printf("%s", str)
运行程序:
go run main.go
打印结果:
[4 24 27 30 46 115 128 1000]

os.Getpid()返回调用者所在进程的进程ID

例子 :str := os.Getpid() 返回一个int
fmt.Printf("%s", str)
运行程序:
go run main.go
打印结果:
5297

os.Getppid()返回调用者所在进程的父进程的进程ID

例子 :str := os.Getppid() 返回一个int
fmt.Printf("%s", str)
运行程序:
go run main.go
打印结果:
5611

good bye~

上一篇 下一篇

猜你喜欢

热点阅读