/* Returns 0 if current has the requested access, error code otherwise  */
static int smack_sem_semctl(struct sem_array *sma, int cmd)
/* Returns 0 if current has the requested access, error code otherwise  */
static int smack_sem_semctl(struct sem_array *sma, int cmd)
{
	int may;
	switch (cmd) {
	case GETPID:
	case GETNCNT:
	case GETZCNT:
	case GETVAL:
	case GETALL:
	case IPC_STAT:
	case SEM_STAT:
		may = MAY_READ;
		break;
	case SETVAL:
	case SETALL:
	case IPC_RMID:
	case IPC_SET:
		may = MAY_READWRITE;
		break;
	case IPC_INFO:
	case SEM_INFO:
		return 0;
	default:
		return -EINVAL;
	}
	return smk_curacc_sem(sma, may);
}