Deleted Added
full compact
pr_atomic.c (256281) pr_atomic.c (281974)
1/*-
2 * Copyright (c) 2006 Bruce M. Simpson
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 2006 Bruce M. Simpson
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: stable/10/tools/regression/sockets/pr_atomic/pr_atomic.c 165503 2006-12-23 21:07:07Z bms $
26 * $FreeBSD: stable/10/tools/regression/sockets/pr_atomic/pr_atomic.c 281974 2015-04-25 05:31:52Z ngie $
27 */
28
29/*
30 * Regression test for uiomove in kernel; specifically for PR kern/38495.
31 */
32
33#include <sys/types.h>
34#include <sys/socket.h>
35#include <sys/un.h>
36
37#include <stdlib.h>
38#include <signal.h>
39#include <setjmp.h>
40#include <string.h>
41#include <err.h>
42#include <errno.h>
43#include <unistd.h>
44
27 */
28
29/*
30 * Regression test for uiomove in kernel; specifically for PR kern/38495.
31 */
32
33#include <sys/types.h>
34#include <sys/socket.h>
35#include <sys/un.h>
36
37#include <stdlib.h>
38#include <signal.h>
39#include <setjmp.h>
40#include <string.h>
41#include <err.h>
42#include <errno.h>
43#include <unistd.h>
44
45#define TEST_SOCKET "/tmp/test_socket"
45static char socket_path[] = "tmp.XXXXXX";
46
47static jmp_buf myjmpbuf;
48
46
47static jmp_buf myjmpbuf;
48
49void handle_sigalrm(int signo);
50
51void handle_sigalrm(int signo)
49static void handle_sigalrm(int signo __unused)
52{
53 longjmp(myjmpbuf, 1);
54}
55
56int
50{
51 longjmp(myjmpbuf, 1);
52}
53
54int
57main(int argc, char *argv[])
55main(void)
58{
59 struct sockaddr_un un;
60 pid_t pid;
61 int s;
62
56{
57 struct sockaddr_un un;
58 pid_t pid;
59 int s;
60
61 if (mkstemp(socket_path) == -1)
62 err(1, "mkstemp");
63 s = socket(PF_LOCAL, SOCK_DGRAM, 0);
64 if (s == -1)
65 errx(-1, "socket");
66 memset(&un, 0, sizeof(un));
67 un.sun_family = AF_LOCAL;
63 s = socket(PF_LOCAL, SOCK_DGRAM, 0);
64 if (s == -1)
65 errx(-1, "socket");
66 memset(&un, 0, sizeof(un));
67 un.sun_family = AF_LOCAL;
68 unlink(TEST_SOCKET);
69 strcpy(un.sun_path, TEST_SOCKET);
68 unlink(socket_path);
69 strcpy(un.sun_path, socket_path);
70 if (bind(s, (struct sockaddr *)&un, sizeof(un)) == -1)
71 errx(-1, "bind");
72 pid = fork();
73 if (pid == -1)
74 errx(-1, "fork");
75 if (pid == 0) {
76 int conn;
77 char buf[] = "AAAAAAAAA";

--- 32 unchanged lines hidden ---
70 if (bind(s, (struct sockaddr *)&un, sizeof(un)) == -1)
71 errx(-1, "bind");
72 pid = fork();
73 if (pid == -1)
74 errx(-1, "fork");
75 if (pid == 0) {
76 int conn;
77 char buf[] = "AAAAAAAAA";

--- 32 unchanged lines hidden ---