Date: Wed, 15 Jul 2015 14:28:58 +0000 (UTC) From: Peter Holm <pho@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r285602 - user/pho/stress2/misc Message-ID: <201507151428.t6FESwtI096876@svnmir.geo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pho Date: Wed Jul 15 14:28:57 2015 New Revision: 285602 URL: https://svnweb.freebsd.org/changeset/base/285602 Log: Fix use of pthread_create(3). Sponsored by: EMC / Isilon storage division Pointed out by: ngie Modified: user/pho/stress2/misc/fifo2.sh user/pho/stress2/misc/kevent6.sh user/pho/stress2/misc/kevent7.sh user/pho/stress2/misc/kevent8.sh user/pho/stress2/misc/mlockall3.sh user/pho/stress2/misc/mmap7.sh user/pho/stress2/misc/msync.sh user/pho/stress2/misc/sigreturn.sh user/pho/stress2/misc/sndstat.sh user/pho/stress2/misc/umountf7.sh Modified: user/pho/stress2/misc/fifo2.sh ============================================================================== --- user/pho/stress2/misc/fifo2.sh Wed Jul 15 13:28:25 2015 (r285601) +++ user/pho/stress2/misc/fifo2.sh Wed Jul 15 14:28:57 2015 (r285602) @@ -172,7 +172,7 @@ main(void) struct rlimit limit; pthread_t cp[50]; time_t start; - int j; + int e, j; if ((pw = getpwnam("nobody")) == NULL) err(1, "no such user: nobody"); @@ -201,8 +201,8 @@ main(void) if (fork() == 0) { arc4random_stir(); for (j = 0; j < 1; j++) - if (pthread_create(&cp[j], NULL, calls, NULL) != 0) - perror("pthread_create"); + if ((e = pthread_create(&cp[j], NULL, calls, NULL)) != 0) + errc(1, e,"pthread_create"); for (j = 0; j < 1; j++) pthread_join(cp[j], NULL); Modified: user/pho/stress2/misc/kevent6.sh ============================================================================== --- user/pho/stress2/misc/kevent6.sh Wed Jul 15 13:28:25 2015 (r285601) +++ user/pho/stress2/misc/kevent6.sh Wed Jul 15 14:28:57 2015 (r285602) @@ -135,15 +135,15 @@ test(void *arg __unused) int main(void) { - int i; pthread_t cp[PARALLEL], sp; + int e, i; - if (pthread_create(&sp, NULL, spin, NULL) != 0) - perror("pthread_create"); + if ((e = pthread_create(&sp, NULL, spin, NULL)) != 0) + errc(1, e, "pthread_create"); for (i = 0; i < PARALLEL; i++) { - if (pthread_create(&cp[i], NULL, test, NULL) != 0) - perror("pthread_create"); + if ((e = pthread_create(&cp[i], NULL, test, NULL)) != 0) + errc(1, e, "pthread_create"); } Modified: user/pho/stress2/misc/kevent7.sh ============================================================================== --- user/pho/stress2/misc/kevent7.sh Wed Jul 15 13:28:25 2015 (r285601) +++ user/pho/stress2/misc/kevent7.sh Wed Jul 15 14:28:57 2015 (r285602) @@ -221,7 +221,7 @@ main(void) struct passwd *pw; time_t start; pthread_t rp, cp[50]; - int j; + int e, j; if ((pw = getpwnam("nobody")) == NULL) err(1, "no such user: nobody"); @@ -247,12 +247,12 @@ main(void) while (time(NULL) - start < 120) { if (fork() == 0) { arc4random_stir(); - if (pthread_create(&rp, NULL, test, NULL) != 0) - perror("pthread_create"); + if ((e = pthread_create(&rp, NULL, test, NULL)) != 0) + errc(1, e, "pthread_create"); usleep(1000); for (j = 0; j < 50; j++) - if (pthread_create(&cp[j], NULL, calls, NULL) != 0) - perror("pthread_create"); + if ((e = pthread_create(&cp[j], NULL, calls, NULL)) != 0) + errc(1, e, "pthread_create"); for (j = 0; j < 50; j++) pthread_join(cp[j], NULL); Modified: user/pho/stress2/misc/kevent8.sh ============================================================================== --- user/pho/stress2/misc/kevent8.sh Wed Jul 15 13:28:25 2015 (r285601) +++ user/pho/stress2/misc/kevent8.sh Wed Jul 15 14:28:57 2015 (r285602) @@ -140,15 +140,15 @@ test(void *arg __unused) int main(void) { - int i; pthread_t cp[PARALLEL], sp; + int e, i; - if (pthread_create(&sp, NULL, spin, NULL) != 0) - perror("pthread_create"); + if ((e = pthread_create(&sp, NULL, spin, NULL)) != 0) + errc(1, e, "pthread_create"); for (i = 0; i < PARALLEL; i++) { - if (pthread_create(&cp[i], NULL, test, NULL) != 0) - perror("pthread_create"); + if ((e = pthread_create(&cp[i], NULL, test, NULL)) != 0) + errc(1, e, "pthread_create"); } Modified: user/pho/stress2/misc/mlockall3.sh ============================================================================== --- user/pho/stress2/misc/mlockall3.sh Wed Jul 15 13:28:25 2015 (r285601) +++ user/pho/stress2/misc/mlockall3.sh Wed Jul 15 14:28:57 2015 (r285602) @@ -127,7 +127,7 @@ main(void) struct passwd *pw; pid_t pid; pthread_t cp[50]; - int i, j; + int e, i, j; if ((pw = getpwnam("nobody")) == NULL) err(1, "no such user: nobody"); @@ -154,8 +154,8 @@ main(void) for (j = 0; j < N; j++) r[j] = arc4random(); for (j = 0; j < 50; j++) - if (pthread_create(&cp[j], NULL, calls, NULL) != 0) - perror("pthread_create"); + if ((e = pthread_create(&cp[j], NULL, calls, NULL)) != 0) + errc(1, e, "pthread_create"); for (j = 0; j < 50; j++) pthread_join(cp[j], NULL); Modified: user/pho/stress2/misc/mmap7.sh ============================================================================== --- user/pho/stress2/misc/mmap7.sh Wed Jul 15 13:28:25 2015 (r285601) +++ user/pho/stress2/misc/mmap7.sh Wed Jul 15 14:28:57 2015 (r285602) @@ -40,20 +40,19 @@ dir=/tmp odir=`pwd` cd $dir sed '1,/^EOF/d' < $odir/$0 > $dir/wire_no_page.c -mycc -o mmap7 -Wall -Wextra wire_no_page.c -lpthread || exit 1 +mycc -o mmap7 -Wall -Wextra wire_no_page.c -lpthread || exit 1 rm -f wire_no_page.c cd $odir -cp /tmp/mmap7 /tmp/mmap7.inputfile (cd ../testcases/swap; ./swap -t 1m -i 2) & cp /tmp/mmap7 /tmp/mmap7.inputfile -/tmp/mmap7 /tmp/mmap7.inputfile +/tmp/mmap7 /tmp/mmap7.inputfile while ps | grep -v grep | grep -qw swap; do killall -9 swap 2>/dev/null sleep .1 done wait -rm -f /tmp/mmap7 /tmp/mmap7.inputfile +rm -f /tmp/mmap7 /tmp/mmap7.inputfile exit EOF @@ -101,8 +100,8 @@ test2(void *arg __unused) void test(void) { - int error, i; pthread_t cp[3]; + int e, error, i; if ((fd = open(file, O_RDWR)) == -1) err(1, "open %s", file); @@ -117,8 +116,8 @@ test(void) err(1, "mmap"); for (i = 0; i < 3; i++) - if (pthread_create(&cp[i], NULL, test2, NULL) != 0) - perror("pthread_create"); + if ((e = pthread_create(&cp[i], NULL, test2, NULL)) != 0) + errc(1, e, "pthread_create"); for (i = 0; i < 3; i++) pthread_join(cp[i], NULL); Modified: user/pho/stress2/misc/msync.sh ============================================================================== --- user/pho/stress2/misc/msync.sh Wed Jul 15 13:28:25 2015 (r285601) +++ user/pho/stress2/misc/msync.sh Wed Jul 15 14:28:57 2015 (r285602) @@ -159,7 +159,7 @@ main(void) { struct passwd *pw; pthread_t cp[50]; - int i, j; + int e, i, j; if (fork() == 0) wd(); @@ -189,8 +189,8 @@ main(void) for (j = 0; j < N; j++) r[j] = arc4random(); for (j = 0; j < 50; j++) - if (pthread_create(&cp[j], NULL, calls, NULL) != 0) - perror("pthread_create"); + if ((e = pthread_create(&cp[j], NULL, calls, NULL)) != 0) + errc(1, e, "pthread_create"); for (j = 0; j < 50; j++) pthread_join(cp[j], NULL); Modified: user/pho/stress2/misc/sigreturn.sh ============================================================================== --- user/pho/stress2/misc/sigreturn.sh Wed Jul 15 13:28:25 2015 (r285601) +++ user/pho/stress2/misc/sigreturn.sh Wed Jul 15 14:28:57 2015 (r285602) @@ -95,6 +95,7 @@ int main(void) { pthread_t cp; + int e; signal(SIGALRM, hand); signal(SIGILL, hand); @@ -106,8 +107,8 @@ main(void) signal(SIGTRAP, hand); if (fork() == 0) { - if (pthread_create(&cp, NULL, calls, NULL) != 0) - perror("pthread_create"); + if ((e = pthread_create(&cp, NULL, calls, NULL)) != 0) + errc(1, e, "pthread_create"); pthread_join(cp, NULL); _exit(0); Modified: user/pho/stress2/misc/sndstat.sh ============================================================================== --- user/pho/stress2/misc/sndstat.sh Wed Jul 15 13:28:25 2015 (r285601) +++ user/pho/stress2/misc/sndstat.sh Wed Jul 15 14:28:57 2015 (r285602) @@ -112,12 +112,12 @@ int main(void) { pthread_t rp[10]; - int i, j; + int e, i, j; /* Parallel open test */ for (i = 0; i < 10; i++) { - if (pthread_create(&rp[i], NULL, test1, NULL) != 0) - perror("pthread_create"); + if ((e = pthread_create(&rp[i], NULL, test1, NULL)) != 0) + errc(1, e, "pthread_create"); } for (i = 0; i < 10; i++) pthread_join(rp[i], NULL); @@ -129,8 +129,8 @@ main(void) continue; } for (j = 0; j < 4; j++) - if (pthread_create(&rp[j], NULL, test2, NULL) != 0) - perror("pthread_create"); + if ((e = pthread_create(&rp[j], NULL, test2, NULL)) != 0) + errc(1, e, "pthread_create"); for (j = 0; j < 4; j++) pthread_join(rp[j], NULL); Modified: user/pho/stress2/misc/umountf7.sh ============================================================================== --- user/pho/stress2/misc/umountf7.sh Wed Jul 15 13:28:25 2015 (r285601) +++ user/pho/stress2/misc/umountf7.sh Wed Jul 15 14:28:57 2015 (r285602) @@ -30,6 +30,7 @@ # "panic: handle_written_inodeblock: live inodedep 0xcc731200" seen. # http://people.freebsd.org/~pho/stress/log/umountf7.txt +# https://people.freebsd.org/~pho/stress/log/kostik824.txt # Problem only seen with SU+J. [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 @@ -48,7 +49,8 @@ mount | grep "on $mntpoint " | grep -q / mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart mdconfig -a -t swap -s 3g -u $mdstart || exit 1 bsdlabel -w md$mdstart auto -newfs -j md${mdstart}$part > /dev/null +[ "$newfs_flags" = "-U" ] && opt="-j" +newfs $opt md${mdstart}$part > /dev/null mount /dev/md${mdstart}$part $mntpoint daemon sh -c '(cd ../testcases/swap; ./swap -t 2m -i 4)' @@ -144,7 +146,7 @@ int main(int argc, char **argv) { pthread_t rp[3]; - int i; + int e, i; if (argc != 2) errx(1, "Usage: %s <number of files>", argv[0]); @@ -152,14 +154,14 @@ main(int argc, char **argv) n = n2 = -1; pid = getpid(); - if (pthread_create(&rp[0], NULL, cr, NULL) != 0) - err(1, "pthread_create"); + if ((e = pthread_create(&rp[0], NULL, cr, NULL)) != 0) + errc(1, e, "pthread_create"); usleep(arc4random() % 1000); - if (pthread_create(&rp[1], NULL, mv, NULL) != 0) - err(1, "pthread_mv"); + if ((e = pthread_create(&rp[1], NULL, mv, NULL)) != 0) + errc(1, e, "pthread_mv"); usleep(arc4random() % 1000); - if (pthread_create(&rp[2], NULL, rm, NULL) != 0) - perror("pthread_rm"); + if ((e = pthread_create(&rp[2], NULL, rm, NULL)) != 0) + errc(1, e, "pthread_rm"); for (i = 0; i < 3; i++) pthread_join(rp[i], NULL);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201507151428.t6FESwtI096876>