func (ss *SemaphoreSet) GetZCnt(num uint16) (int, error) {
	rc, err := C.semctl_noarg(C.int(ss.id), C.int(num), C.GETZCNT)
	if rc == -1 {
		return 0, err
	}
	return int(rc), nil
}
GetZCnt returns the # of those blocked on WaitZero on the num-th semaphore
package sysvipc
import "C"
import (
	"errors"
	"time"
)
type SemaphoreSet struct {
	id    int64
	count uint
}
func GetSemSet(key, count int64, flags *SemSetFlags) (*SemaphoreSet, error) {
	rc, err := C.semget(C.key_t(key), C.int(count), C.int(flags.flags()))
	if rc == -1 {
		return nil, err
	}
	return &SemaphoreSet{int64(rc), uint(count)}, nil
}
func (ss *SemaphoreSet) Run(ops *SemOps, timeout time.Duration) error {
	var cto *C.struct_timespec
	if timeout >= 0 {
		cto = &C.struct_timespec{
			tv_sec:  C.__time_t(timeout / time.Second),
			tv_nsec: C.__syscall_slong_t(timeout % time.Second),
		}
	}
	var opptr *C.struct_sembuf
	if len(*ops) > 0 {
		opptr = &(*ops)[0]
	}
	rc, err := C.semtimedop(C.int(ss.id), opptr, C.size_t(len(*ops)), cto)
	if rc == -1 {
		return err
	}
	return nil
}
func (ss *SemaphoreSet) Getval(num uint16) (int, error) {
	val, err := C.semctl_noarg(C.int(ss.id), C.int(num), C.GETVAL)
	if val == -1 {
		return -1, err
	}
	return int(val), nil
}
func (ss *SemaphoreSet) Setval(num uint16, value int) error {
	val, err := C.semctl_val(C.int(ss.id), C.int(num), C.SETVAL, C.int(value))
	if val == -1 {
		return err
	}
	return nil
}
func (ss *SemaphoreSet) Getall() ([]uint16, error) {
	carr := make([]C.ushort, ss.count)
	rc, err := C.semctl_arr(C.int(ss.id), C.GETALL, &carr[0])
	if rc == -1 {
		return nil, err
	}
	results := make([]uint16, ss.count)
	for i, ci := range carr {
		results[i] = uint16(ci)
	}
	return results, nil
}
func (ss *SemaphoreSet) Setall(values []uint16) error {
	if uint(len(values)) != ss.count {
		return errors.New("sysvipc: wrong number of values for Setall")
	}
	carr := make([]C.ushort, ss.count)
	for i, val := range values {
		carr[i] = C.ushort(val)
	}
	rc, err := C.semctl_arr(C.int(ss.id), C.SETALL, &carr[0])
	if rc == -1 {
		return err
	}
	return nil
}
func (ss *SemaphoreSet) Getpid(num uint16) (int, error) {
	rc, err := C.semctl_noarg(C.int(ss.id), C.int(num), C.GETPID)
	if rc == -1 {
		return 0, err
	}
	return int(rc), nil
}
func (ss *SemaphoreSet) GetNCnt(num uint16) (int, error) {
	rc, err := C.semctl_noarg(C.int(ss.id), C.int(num), C.GETNCNT)
	if rc == -1 {
		return 0, err
	}
	return int(rc), nil
}