forked from keybase/client
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make Statfs and Fsync timeout faster for unmounting (keybase#24433)
* make Statfs and Fsync timeout faster for unmounting Otherwise if service has already exited, these calls will hang forever causing both `umount` and `diskutil umount force` to block. Eventually something else kicks in and kills the KBFS process, leaving behind a mount point. With this fix, there's a greater chance that unmounting happens before the KBFS process gets killed. * strib feedback
- Loading branch information
Showing
7 changed files
with
132 additions
and
12 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,41 @@ | ||
// Copyright 2021 Keybase Inc. All rights reserved. | ||
// Use of this source code is governed by a BSD | ||
// license that can be found in the LICENSE file. | ||
// | ||
// +build darwin | ||
|
||
package libfuse | ||
|
||
// #include <libproc.h> | ||
// #include <stdlib.h> | ||
// #include <errno.h> | ||
import "C" | ||
|
||
import ( | ||
"errors" | ||
"strconv" | ||
"unsafe" | ||
) | ||
|
||
// pidPath returns the exec path for process pid. Adapted from | ||
// https://ops.tips/blog/macos-pid-absolute-path-and-procfs-exploration/ | ||
func pidPath(pid int) (path string, err error) { | ||
const bufSize = C.PROC_PIDPATHINFO_MAXSIZE | ||
buf := C.CString(string(make([]byte, bufSize))) | ||
defer C.free(unsafe.Pointer(buf)) | ||
|
||
ret, err := C.proc_pidpath(C.int(pid), unsafe.Pointer(buf), bufSize) | ||
if err != nil { | ||
return "", err | ||
} | ||
if ret < 0 { | ||
return "", errors.New( | ||
"error calling proc_pidpath. exit code: " + strconv.Itoa(int(ret))) | ||
} | ||
if ret == 0 { | ||
return "", errors.New("proc_pidpath returned empty buffer") | ||
} | ||
|
||
path = C.GoString(buf) | ||
return | ||
} |
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,15 @@ | ||
// Copyright 2021 Keybase Inc. All rights reserved. | ||
// Use of this source code is governed by a BSD | ||
// license that can be found in the LICENSE file. | ||
// | ||
// +build !darwin | ||
|
||
package libfuse | ||
|
||
import "github.com/pkg/errors" | ||
|
||
var notImplementedErr = errors.New("unimplemented") | ||
|
||
func pidPath(_ int) (path string, err error) { | ||
return "", notImplementedErr | ||
} |
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