-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c42dc88
commit 3bc5ead
Showing
10 changed files
with
108 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// +build netbsd | ||
|
||
/* | ||
* port_netbsd.go | ||
* | ||
* Copyright 2017-2018 Bill Zissimopoulos | ||
*/ | ||
/* | ||
* This file is part of Cgofuse. | ||
* | ||
* It is licensed under the MIT license. The full license text can be found | ||
* in the License.txt file at the root of this project. | ||
*/ | ||
|
||
package main | ||
|
||
import ( | ||
"syscall" | ||
|
||
"github.com/billziss-gh/cgofuse/fuse" | ||
) | ||
|
||
func setuidgid() func() { | ||
euid := syscall.Geteuid() | ||
if 0 == euid { | ||
uid, gid, _ := fuse.Getcontext() | ||
egid := syscall.Getegid() | ||
syscall.Setegid(int(gid)) | ||
syscall.Seteuid(int(uid)) | ||
return func() { | ||
syscall.Seteuid(euid) | ||
syscall.Setegid(egid) | ||
} | ||
} | ||
return func() { | ||
} | ||
} | ||
|
||
func copyFusestatfsFromGostatfs(dst *fuse.Statfs_t, src *syscall.Statfs_t) { | ||
*dst = fuse.Statfs_t{} | ||
dst.Namemax = 255 | ||
} | ||
|
||
func copyFusestatFromGostat(dst *fuse.Stat_t, src *syscall.Stat_t) { | ||
*dst = fuse.Stat_t{} | ||
dst.Dev = uint64(src.Dev) | ||
dst.Ino = uint64(src.Ino) | ||
dst.Mode = uint32(src.Mode) | ||
dst.Nlink = uint32(src.Nlink) | ||
dst.Uid = uint32(src.Uid) | ||
dst.Gid = uint32(src.Gid) | ||
dst.Rdev = uint64(src.Rdev) | ||
dst.Size = int64(src.Size) | ||
dst.Atim.Sec, dst.Atim.Nsec = src.Atimespec.Sec, src.Atimespec.Nsec | ||
dst.Mtim.Sec, dst.Mtim.Nsec = src.Mtimespec.Sec, src.Mtimespec.Nsec | ||
dst.Ctim.Sec, dst.Ctim.Nsec = src.Ctimespec.Sec, src.Ctimespec.Nsec | ||
dst.Blksize = int64(src.Blksize) | ||
dst.Blocks = int64(src.Blocks) | ||
dst.Birthtim.Sec, dst.Birthtim.Nsec = src.Birthtimespec.Sec, src.Birthtimespec.Nsec | ||
} | ||
|
||
func syscall_Statfs(path string, stat *syscall.Statfs_t) error { | ||
*stat = syscall.Statfs_t{} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// +build darwin freebsd openbsd linux | ||
// +build darwin freebsd netbsd openbsd linux | ||
|
||
/* | ||
* host_unix_test.go | ||
|