kdlucas / byte-unixbench

Automatically exported from code.google.com/p/byte-unixbench
GNU General Public License v2.0
1.27k stars 323 forks source link

Error on FreeBSD 10: ERROR: slave read failed: No such file or directory #32

Closed do11 closed 8 years ago

do11 commented 8 years ago

There is intermittent error on FreeBSD 10.

Pipe-based Context Switching -- 1 copy
==> "/mnt/xxx/byte-unixbench/UnixBench/pgms/context1" 10 2>&1 >> "/mnt/xxx/byte-unixbench/UnixBench/results/test-2016-01-12-03.log"

#### Pass 1

# COUNT0: 1653905
# COUNT1: 1
# COUNT2: lps
# ERROR: slave read failed: No such file or directory
# elapsed: 10.034850
# pid: 2346
# status: 0

Hack:

src/context1.c:
if (read(p1[0], (char *)&check, sizeof(check)) != sizeof(check)) {
                                if ((errno != 0) && (errno != EINTR))
                                        perror("slave read failed");
                                exit(1);
}

Additional note:

You incorrectly check return value of read(). errno should be checked only if read() returns -1, otherwise it may contain garbage (as it occurs on Freebsd 10).

gstrauss commented 8 years ago

This is fixed in commit 64c45b4