Example #1
0
func Fadvise(fd uintptr, off int64, size int64, advise int) (err error) {
	var errno int
	if errno = int(C.posix_fadvise(C.int(fd), C.__off_t(off), C.__off_t(size), C.int(advise))); errno != 0 {
		err = syscall.Errno(errno)
	}
	return
}
func (a *InoAttr) toCStat(o *C.struct_stat, timeout *C.double) {
	o.st_ino = C.__ino_t(a.Ino)
	o.st_mode = C.__mode_t(a.Mode)
	o.st_nlink = C.__nlink_t(a.Nlink)
	o.st_size = C.__off_t(a.Size)
	if a.Uid != nil {
		o.st_uid = C.__uid_t(*a.Uid)
	}
	if a.Gid != nil {
		o.st_gid = C.__gid_t(*a.Gid)
	}
	toCTime(&o.st_ctim, a.Ctim)
	toCTime(&o.st_mtim, a.Mtim)
	toCTime(&o.st_atim, a.Atim)
	if timeout != nil {
		(*timeout) = C.double(a.Timeout)
	}
}
Example #3
0
func DropBufferCache(fd int, length int64) {
	C.posix_fadvise(C.int(fd), C.__off_t(0), C.__off_t(length), C.int(4))
}