Esempio n. 1
0
func (c *cfen) port_associate(p int, fo FileObj, e int) (err error) {
	cfo := C.newFo()
	cfo.fo_atime.tv_sec, cfo.fo_atime.tv_nsec = unix2C(fo.Atim.Unix())
	cfo.fo_mtime.tv_sec, cfo.fo_mtime.tv_nsec = unix2C(fo.Mtim.Unix())
	cfo.fo_ctime.tv_sec, cfo.fo_ctime.tv_nsec = unix2C(fo.Ctim.Unix())
	cfo.fo_name = C.CString(fo.Name)
	c.p2fo[fo.Name] = cfo
	_, err = C.port_associate(C.int(p), srcFile, C.conv(cfo), C.int(e), nil)
	return
}
Esempio n. 2
0
func (c *cfen) port_dissociate(port int, fo FileObj) (err error) {
	cfo, ok := c.p2fo[fo.Name]
	if !ok {
		return errNotWatched
	}
	_, err = C.port_dissociate(C.int(port), srcFile, C.conv(cfo))
	C.free(unsafe.Pointer(cfo.fo_name))
	C.free(unsafe.Pointer(cfo))
	delete(c.p2fo, fo.Name)
	return
}