FreeBSD/tools/regression/sockets/sblock/sblock.c
/*
 * Process that will perform a locking recv on a UNIX domain socket.
 *
 * This is where we figure out if the test worked or not.  If it has failed,
 * then recv() will return EOF, as the close() arrives before the signal,
 * meaning that the wait for the sblock was not interrupted; if it has
 * succeeded, we get EINTR as the signal interrupts the lock request.
 */
Process that will perform a locking recv on a UNIX domain socket.
This is where we figure out if the test worked or not.  If it has failed,
then recv() will return EOF, as the close() arrives before the signal,
meaning that the wait for the sblock was not interrupted; if it has
succeeded, we get EINTR as the signal interrupts the lock request.
Process that will perform a locking recv on a UNIX domain socket . This is where we figure out if the test worked or not . If it has failed then recv () will return EOF as the close () arrives before the signal meaning that the wait for the sblock was not interrupted ; if it has succeeded we get EINTR as the signal interrupts the lock request .
static void
locking_recver(int fd)
{
	ssize_t len;
	char ch;
	if (sleep(1) != 0)
		err(-1, "FAIL: locking_recver: sleep");
	len = recv(fd, &ch, sizeof(ch), 0);
	if (len < 0 && errno != EINTR)
		err(-1, "FAIL: locking_recver: recv");
	if (len < 0 && errno == EINTR) {
		fprintf(stderr, "PASS\n");
		exit(0);
	}
	if (len == 0)
		errx(-1, "FAIL: locking_recver: recv: eof");
	if (!interrupted)
		errx(-1, "FAIL: locking_recver: not interrupted");
}
static void locking_recver ( int fd ) { ssize_t len ; char ch ; if ( sleep ( 1 ) != 0 ) err ( -1 , " " ) ; len = recv ( fd , & ch , sizeof ( ch ) , 0 ) ; if ( len < 0 && errno != EINTR ) err ( -1 , " " ) ; if ( len < 0 && errno == EINTR ) { fprintf ( stderr , " \n " ) ; exit ( 0 ) ; } if ( len == 0 ) errx ( -1 , " " ) ; if ( ! interrupted ) errx ( -1 , " " ) ; }
Process that will perform a locking recv on a UNIX domain socket.
Process that will perform a locking recv on a UNIX domain socket .