Skip to content

Commit 25cbe1b

Browse files
Geliang Tangintel-lab-lkp
authored andcommitted
selftests: mptcp: sockopt: rename pipefd to ipcfd
Rename pipefd to ipcfd to better reflect its generalized purpose since it now handles both pipes and Unix domain sockets. This naming improves code clarity for IPC channel handling. Signed-off-by: Geliang Tang <[email protected]>
1 parent 1195070 commit 25cbe1b

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

tools/testing/selftests/net/mptcp/mptcp_sockopt.c

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ static int xaccept(int s)
722722
return fd;
723723
}
724724

725-
static int server(int pipefd)
725+
static int server(int ipcfd)
726726
{
727727
int fd = -1, r;
728728

@@ -738,13 +738,13 @@ static int server(int pipefd)
738738
break;
739739
}
740740

741-
r = write(pipefd, "conn", 4);
741+
r = write(ipcfd, "conn", 4);
742742
assert(r == 4);
743743

744744
alarm(15);
745745
r = xaccept(fd);
746746

747-
process_one_client(r, pipefd);
747+
process_one_client(r, ipcfd);
748748

749749
return 0;
750750
}
@@ -787,7 +787,7 @@ static void test_ip_tos_sockopt(int fd)
787787
xerror("expect socklen_t == -1");
788788
}
789789

790-
static int client(int pipefd)
790+
static int client(int ipcfd)
791791
{
792792
int fd = -1;
793793

@@ -806,7 +806,7 @@ static int client(int pipefd)
806806

807807
test_ip_tos_sockopt(fd);
808808

809-
connect_one_server(fd, pipefd);
809+
connect_one_server(fd, ipcfd);
810810

811811
return 0;
812812
}
@@ -853,31 +853,32 @@ int main(int argc, char *argv[])
853853
{
854854
int e1, e2, wstatus;
855855
pid_t s, c, ret;
856-
int pipefds[2];
856+
int ipcfds[2];
857857

858858
parse_opts(argc, argv);
859859

860860
init_rng();
861861

862-
e1 = pipe(pipefds);
862+
e1 = inq ? socketpair(AF_UNIX, SOCK_DGRAM, 0, ipcfds) :
863+
pipe(ipcfds);
863864
if (e1 < 0)
864865
die_perror("pipe");
865866

866867
s = xfork();
867868
if (s == 0)
868-
return server(pipefds[1]);
869+
return server(ipcfds[1]);
869870

870-
close(pipefds[1]);
871+
close(ipcfds[1]);
871872

872873
/* wait until server bound a socket */
873-
e1 = read(pipefds[0], &e1, 4);
874+
e1 = read(ipcfds[0], &e1, 4);
874875
assert(e1 == 4);
875876

876877
c = xfork();
877878
if (c == 0)
878-
return client(pipefds[0]);
879+
return client(ipcfds[0]);
879880

880-
close(pipefds[0]);
881+
close(ipcfds[0]);
881882

882883
ret = waitpid(s, &wstatus, 0);
883884
if (ret == -1)

0 commit comments

Comments
 (0)