Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

netstat: Fix duplicate keys in libxo output #1331

Merged
merged 4 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions sys/security/mac_veriexec_parser/mac_veriexec_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,9 @@

NDINIT(nid, LOOKUP, 0, UIO_SYSSPACE, path);
rc = vn_open(nid, &flags, 0, NULL);
NDFREE_PNBUF(nid);
if (rc != 0)
return (rc);
NDFREE_PNBUF(nid);

return (0);
}
Expand Down Expand Up @@ -346,10 +346,9 @@
}

rc = open_file(path, &nid);
NDFREE_PNBUF(&nid);
if (rc != 0)
return (rc);

Check warning on line 351 in sys/security/mac_veriexec_parser/mac_veriexec_parser.c

View workflow job for this annotation

GitHub Actions / Style Checker

Missing Signed-off-by: line

Check warning on line 351 in sys/security/mac_veriexec_parser/mac_veriexec_parser.c

View workflow job for this annotation

GitHub Actions / Style Checker

Missing Signed-off-by: line

Check warning on line 351 in sys/security/mac_veriexec_parser/mac_veriexec_parser.c

View workflow job for this annotation

GitHub Actions / Style Checker

Missing Signed-off-by: line
rc = VOP_GETATTR(nid.ni_vp, &va, curthread->td_ucred);
if (rc != 0)
goto out;
Expand Down
10 changes: 8 additions & 2 deletions usr.bin/netstat/if.c
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,11 @@
IFA_STAT(ipackets), link|network, 1);
show_stat("lu", nerr_len, "received-errors", IFA_STAT(ierrors),
link, 1);
/* Below is kept for backwards compatibility. Will be removed before FreeBSD 16. */

Check warning on line 504 in usr.bin/netstat/if.c

View workflow job for this annotation

GitHub Actions / Style Checker

line over 80 characters

Check warning on line 504 in usr.bin/netstat/if.c

View workflow job for this annotation

GitHub Actions / Style Checker

line over 80 characters

Check warning on line 504 in usr.bin/netstat/if.c

View workflow job for this annotation

GitHub Actions / Style Checker

line over 80 characters

Check warning on line 504 in usr.bin/netstat/if.c

View workflow job for this annotation

GitHub Actions / Style Checker

line over 80 characters

Check warning on line 504 in usr.bin/netstat/if.c

View workflow job for this annotation

GitHub Actions / Style Checker

line over 80 characters

Check warning on line 504 in usr.bin/netstat/if.c

View workflow job for this annotation

GitHub Actions / Style Checker

line over 80 characters
show_stat("lu", nerr_len, "dropped-packets", IFA_STAT(iqdrops),
link, 1);
show_stat("lu", nerr_len, "dropped-packets-in", IFA_STAT(iqdrops),

Check warning on line 507 in usr.bin/netstat/if.c

View workflow job for this annotation

GitHub Actions / Style Checker

line over 80 characters

Check warning on line 507 in usr.bin/netstat/if.c

View workflow job for this annotation

GitHub Actions / Style Checker

line over 80 characters

Check warning on line 507 in usr.bin/netstat/if.c

View workflow job for this annotation

GitHub Actions / Style Checker

line over 80 characters
link, 1);
if (bflag)
show_stat("lu", nbyte_len, "received-bytes",
IFA_STAT(ibytes), link|network, 0);
Expand All @@ -516,7 +519,7 @@
show_stat("NRSlu", nerr_len, "collisions", IFA_STAT(collisions),
link, 1);
if (dflag)
show_stat("LSlu", nerr_len, "dropped-packets",
show_stat("LSlu", nerr_len, "dropped-packets-out",
IFA_STAT(oqdrops), link, 1);
xo_emit("\n");

Expand Down Expand Up @@ -705,8 +708,11 @@
new->ift_ip - old->ift_ip, 1, 1);
show_stat("lu", 5, "received-errors",
new->ift_ie - old->ift_ie, 1, 1);
/* Below is kept for backwards compatibility. Will be removed before FreeBSD 16. */

Check warning on line 711 in usr.bin/netstat/if.c

View workflow job for this annotation

GitHub Actions / Style Checker

line over 80 characters

Check warning on line 711 in usr.bin/netstat/if.c

View workflow job for this annotation

GitHub Actions / Style Checker

line over 80 characters

Check warning on line 711 in usr.bin/netstat/if.c

View workflow job for this annotation

GitHub Actions / Style Checker

line over 80 characters

Check warning on line 711 in usr.bin/netstat/if.c

View workflow job for this annotation

GitHub Actions / Style Checker

line over 80 characters

Check warning on line 711 in usr.bin/netstat/if.c

View workflow job for this annotation

GitHub Actions / Style Checker

line over 80 characters

Check warning on line 711 in usr.bin/netstat/if.c

View workflow job for this annotation

GitHub Actions / Style Checker

line over 80 characters
show_stat("lu", 5, "dropped-packets",
new->ift_id - old->ift_id, 1, 1);
show_stat("lu", 5, "dropped-packets-in",
bramton marked this conversation as resolved.
Show resolved Hide resolved
new->ift_id - old->ift_id, 1, 1);
show_stat("lu", 10, "received-bytes",
new->ift_ib - old->ift_ib, 1, 0);
show_stat("lu", 10, "sent-packets",
Expand All @@ -718,10 +724,10 @@
show_stat("NRSlu", 5, "collisions",
new->ift_co - old->ift_co, 1, 1);
if (dflag)
show_stat("LSlu", 5, "dropped-packets",
show_stat("LSlu", 5, "dropped-packets-out",
new->ift_od - old->ift_od, 1, 1);
xo_close_instance("stats");
xo_emit("\n");

Check warning on line 730 in usr.bin/netstat/if.c

View workflow job for this annotation

GitHub Actions / Style Checker

Missing Signed-off-by: line

Check warning on line 730 in usr.bin/netstat/if.c

View workflow job for this annotation

GitHub Actions / Style Checker

Missing Signed-off-by: line

Check warning on line 730 in usr.bin/netstat/if.c

View workflow job for this annotation

GitHub Actions / Style Checker

Missing Signed-off-by: line
xo_flush();

if (new == &ift[0]) {
Expand Down
2 changes: 1 addition & 1 deletion usr.bin/netstat/sctp.c
Original file line number Diff line number Diff line change
Expand Up @@ -711,10 +711,10 @@
"secret\n");
p(sctps_timopathmtu, "\t\t{:pmtu-timer/%ju} "
"{N:/PMTU timer%s fired}\n");
p(sctps_timoshutdownack, "\t\t{:shutdown-timer/%ju} "
p(sctps_timoshutdownack, "\t\t{:shutdown-ack-timer/%ju} "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me.

"{N:/shutdown ack timer%s fired}\n");
p(sctps_timoshutdownguard, "\t\t{:shutdown-guard-timer/%ju} "
"{N:/shutdown guard timer%s fired}\n");

Check warning on line 717 in usr.bin/netstat/sctp.c

View workflow job for this annotation

GitHub Actions / Style Checker

Missing Signed-off-by: line

Check warning on line 717 in usr.bin/netstat/sctp.c

View workflow job for this annotation

GitHub Actions / Style Checker

Missing Signed-off-by: line

Check warning on line 717 in usr.bin/netstat/sctp.c

View workflow job for this annotation

GitHub Actions / Style Checker

Missing Signed-off-by: line
p(sctps_timostrmrst, "\t\t{:stream-reset-timer/%ju} "
"{N:/stream reset timer%s fired}\n");
p(sctps_timoearlyfr, "\t\t{:early-fast-retransmission-timer/%ju} "
Expand Down
12 changes: 6 additions & 6 deletions usr.sbin/i2c/i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,7 @@

/* Default values */
i2c_opt.off = 0;
i2c_opt.addr = 0;
i2c_opt.verbose = 0;
i2c_opt.dir = 'r'; /* direction = read */
i2c_opt.width = "8";
Expand Down Expand Up @@ -875,12 +876,6 @@
return(EX_USAGE);
}

if (i2c_opt.verbose)
fprintf(stderr, "dev: %s, addr: 0x%x, r/w: %c, "
"offset: 0x%02x, width: %s, count: %u\n", dev,
i2c_opt.addr >> 1, i2c_opt.dir, i2c_opt.off,
i2c_opt.width, i2c_opt.count);

fd = open(dev, O_RDWR);
if (fd == -1) {
fprintf(stderr, "Error opening I2C controller (%s): %s\n",
Expand All @@ -890,9 +885,14 @@

switch (do_what) {
case 'a':
if (i2c_opt.verbose)
fprintf(stderr, "dev: %s, addr: 0x%x, r/w: %c, "
"offset: 0x%02x, width: %s, count: %u\n", dev,
i2c_opt.addr >> 1, i2c_opt.dir, i2c_opt.off,
i2c_opt.width, i2c_opt.count);
error = access_bus(fd, i2c_opt);
break;
case 's':

Check warning on line 895 in usr.sbin/i2c/i2c.c

View workflow job for this annotation

GitHub Actions / Style Checker

Missing Signed-off-by: line

Check warning on line 895 in usr.sbin/i2c/i2c.c

View workflow job for this annotation

GitHub Actions / Style Checker

Missing Signed-off-by: line

Check warning on line 895 in usr.sbin/i2c/i2c.c

View workflow job for this annotation

GitHub Actions / Style Checker

Missing Signed-off-by: line
error = scan_bus(dev, fd, i2c_opt.skip, i2c_opt.verbose);
break;
case 'r':
Expand Down
Loading