File: poll_linux.go

package info (click to toggle)
golang-github-hanwen-go-fuse 0.0~git20190214.58dcd77-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,076 kB
  • sloc: cpp: 78; sh: 77; makefile: 16
file content (25 lines) | stat: -rw-r--r-- 489 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package fuse

import (
	"path/filepath"
	"syscall"

	"golang.org/x/sys/unix"
)

func pollHack(mountPoint string) error {
	fd, err := syscall.Creat(filepath.Join(mountPoint, pollHackName), syscall.O_CREAT)
	if err != nil {
		return err
	}
	pollData := []unix.PollFd{{
		Fd:     int32(fd),
		Events: unix.POLLIN | unix.POLLPRI | unix.POLLOUT,
	}}

	// Trigger _OP_POLL, so we can say ENOSYS. We don't care about
	// the return value.
	unix.Poll(pollData, 0)
	syscall.Close(fd)
	return nil
}