[LTP] [PATCH v3 03/10] Rewrite sem_comm.c using new LTP API

Cyril Hrubis chrubis@suse.cz
Thu Mar 24 16:04:59 CET 2022


Hi!
> +	TEST(semop(id, &sm, 1));
> +	if (TST_RET < 0) {
> +		if (TST_ERR != EAGAIN)
> +			tst_brk(TBROK | TERRNO, "semop error");
> +
> +		tst_res(TFAIL, "can't lock semaphore between namespaces");

The message is very confusing here. If we get here the semaphone was
locked by the other child in a different namespace. We should print
something as "semaphore decremented from different namespace"

> +	} else {
> +		tst_res(TPASS, "locked semaphore between namespaces");

Here as well, confusing message.

>  	}
>  
>  	/* tell child1 to continue */
> -	TST_SAFE_CHECKPOINT_WAKE(NULL, 0);
> +	TST_CHECKPOINT_WAKE(0);
>  
>  	sm.sem_op = 1;
> -	semop(id, &sm, 1);
> +	SAFE_SEMOP(id, &sm, 1);

I wonder if it's necessary to modify the semaphore value before the
RMDID here. Can't we just remove it instead?

> +	SAFE_SEMCTL(id, 0, IPC_RMID);

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list