[LTP] [PATCH 1/2] syscalls/shmdt01: Convert into new api

Cyril Hrubis chrubis@suse.cz
Wed Apr 27 17:14:49 CEST 2022


Hi!
> +static int shm_id = -1, shm_key, pass;
> +static int *shared;
>  sigjmp_buf env;

^ static sigjmp_buf

> +static void check_functionality(void)
>  {
> -	/* stat the shared memory segment */
> -	if (shmctl(shm_id_1, IPC_STAT, &buf) == -1)
> -		tst_brkm(TBROK | TERRNO, cleanup,
> -			 "could not stat in signal handler");
> +	struct shmid_ds buf;
>  
> +	SAFE_SHMCTL(shm_id, IPC_STAT, &buf);
>  	if (buf.shm_nattch != 0) {
> -		tst_resm(TFAIL, "# of attaches is incorrect");
> +		tst_res(TFAIL, "Number of attaches(%ld) is non-zero", buf.shm_nattch);
>  		return;
>  	}

Maybe just:

	TST_EXP_EQ_LI(buf.shm_nattch, 0);

	if (buf.shm_nattach)
		return;



Other than these two:

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>


-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list