func (d *Device) Sysattrs() (r map[string]struct{}) {
	d.lock()
	defer d.unlock()
	r = make(map[string]struct{})
	for l := C.udev_device_get_sysattr_list_entry(d.ptr); l != nil; l = C.udev_list_entry_get_next(l) {
		r[C.GoString(C.udev_list_entry_get_name(l))] = struct{}{}
	}
	return
}
Sysattrs returns a Set with the systems attributes of the udev device.
package udev
import "C"
import "errors"
import "github.com/jkeiser/iter"
type Device struct {
	ptr *C.struct_udev_device
	u   *Udev
}
func (d *Device) lock() {
	d.u.m.Lock()
}
func (d *Device) unlock() {
	d.u.m.Unlock()
}
func deviceUnref(d *Device) {
	C.udev_device_unref(d.ptr)
}
func (d *Device) Parent() *Device {
	d.lock()
	defer d.unlock()
	ptr := C.udev_device_get_parent(d.ptr)
	if ptr != nil {
		C.udev_device_ref(ptr)
	}
	return d.u.newDevice(ptr)
}
func (d *Device) ParentWithSubsystemDevtype(subsystem, devtype string) *Device {
	d.lock()
	defer d.unlock()
	ss, dt := C.CString(subsystem), C.CString(devtype)
	defer freeCharPtr(ss)
	defer freeCharPtr(dt)
	ptr := C.udev_device_get_parent_with_subsystem_devtype(d.ptr, ss, dt)
	if ptr != nil {
		C.udev_device_ref(ptr)
	}
	return d.u.newDevice(ptr)
}
func (d *Device) Devpath() string {
	d.lock()
	defer d.unlock()
	return C.GoString(C.udev_device_get_devpath(d.ptr))
}
func (d *Device) Subsystem() string {
	d.lock()
	defer d.unlock()
	return C.GoString(C.udev_device_get_subsystem(d.ptr))
}
func (d *Device) Devtype() string {
	d.lock()
	defer d.unlock()
	return C.GoString(C.udev_device_get_devtype(d.ptr))
}
func (d *Device) Syspath() string {
	d.lock()
	defer d.unlock()
	return C.GoString(C.udev_device_get_syspath(d.ptr))
}
func (d *Device) Sysnum() string {
	d.lock()
	defer d.unlock()
	return C.GoString(C.udev_device_get_sysnum(d.ptr))
}
func (d *Device) Devnode() string {
	d.lock()
	defer d.unlock()
	return C.GoString(C.udev_device_get_devnode(d.ptr))
}
func (d *Device) IsInitialized() bool {
	d.lock()
	defer d.unlock()
	return C.udev_device_get_is_initialized(d.ptr) != 0
}
func (d *Device) Devlinks() (r map[string]struct{}) {
	d.lock()
	defer d.unlock()
	r = make(map[string]struct{})
	for l := C.udev_device_get_devlinks_list_entry(d.ptr); l != nil; l = C.udev_list_entry_get_next(l) {
		r[C.GoString(C.udev_list_entry_get_name(l))] = struct{}{}
	}
	return
}
func (d *Device) DevlinkIterator() iter.Iterator {
	d.lock()
	defer d.unlock()
	l := C.udev_device_get_devlinks_list_entry(d.ptr)
	return iter.Iterator{
		Next: func() (item interface{}, err error) {
			d.lock()
			defer d.unlock()
			if l != nil {
				item = C.GoString(C.udev_list_entry_get_name(l))
				l = C.udev_list_entry_get_next(l)
			} else {
				err = iter.FINISHED
			}
			return
		},
		Close: func() {
		},
	}
}
func (d *Device) Properties() (r map[string]string) {
	d.lock()
	defer d.unlock()
	r = make(map[string]string)
	for l := C.udev_device_get_properties_list_entry(d.ptr); l != nil; l = C.udev_list_entry_get_next(l) {
		r[C.GoString(C.udev_list_entry_get_name(l))] = C.GoString(C.udev_list_entry_get_value(l))
	}
	return
}
func (d *Device) PropertyIterator() iter.Iterator {
	d.lock()
	defer d.unlock()
	l := C.udev_device_get_properties_list_entry(d.ptr)
	return iter.Iterator{
		Next: func() (item interface{}, err error) {
			d.lock()
			defer d.unlock()
			if l != nil {
				item = []string{
					C.GoString(C.udev_list_entry_get_name(l)),
					C.GoString(C.udev_list_entry_get_value(l)),
				}
				l = C.udev_list_entry_get_next(l)
			} else {
				err = iter.FINISHED
			}
			return
		},
		Close: func() {
		},
	}
}
func (d *Device) Tags() (r map[string]struct{}) {
	d.lock()
	defer d.unlock()
	r = make(map[string]struct{})
	for l := C.udev_device_get_tags_list_entry(d.ptr); l != nil; l = C.udev_list_entry_get_next(l) {
		r[C.GoString(C.udev_list_entry_get_name(l))] = struct{}{}
	}
	return
}
func (d *Device) TagIterator() iter.Iterator {
	d.lock()
	defer d.unlock()
	l := C.udev_device_get_tags_list_entry(d.ptr)
	return iter.Iterator{
		Next: func() (item interface{}, err error) {
			d.lock()
			defer d.unlock()
			if l != nil {
				item = C.GoString(C.udev_list_entry_get_name(l))
				l = C.udev_list_entry_get_next(l)
			} else {
				err = iter.FINISHED
			}
			return
		},
		Close: func() {
		},
	}
}