c99006518907cf732991111230ff54a12bec797a
[oom/registrator.git] /
1 // +build linux,386
2
3 package system
4
5 import (
6         "syscall"
7 )
8
9 // Setuid sets the uid of the calling thread to the specified uid.
10 func Setuid(uid int) (err error) {
11         _, _, e1 := syscall.RawSyscall(syscall.SYS_SETUID, uintptr(uid), 0, 0)
12         if e1 != 0 {
13                 err = e1
14         }
15         return
16 }
17
18 // Setgid sets the gid of the calling thread to the specified gid.
19 func Setgid(gid int) (err error) {
20         _, _, e1 := syscall.RawSyscall(syscall.SYS_SETGID32, uintptr(gid), 0, 0)
21         if e1 != 0 {
22                 err = e1
23         }
24         return
25 }