Page MenuHomeFreeBSD

netstat: Complete libxo transition.
ClosedPublic

Authored by yanhaowang on Aug 11 2023, 1:30 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 4, 4:37 PM
Unknown Object (File)
Sun, Nov 3, 1:34 PM
Unknown Object (File)
Tue, Oct 22, 6:35 PM
Unknown Object (File)
Sun, Oct 20, 2:12 PM
Unknown Object (File)
Sun, Oct 20, 2:12 PM
Unknown Object (File)
Sun, Oct 20, 2:12 PM
Unknown Object (File)
Sun, Oct 20, 2:12 PM
Unknown Object (File)
Sun, Oct 20, 12:26 PM

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This program uses sysexits(3), but not consistently. This should be fixed. I've highlighted some of the required changes.

usr.bin/netstat/common.c
116

EX_OSERR

usr.bin/netstat/main.c
464

EX_OSERR

470

EX_USAGE

477

EX_IOERR

478

EX_OK

946

There is no need to call xo_finish() here.

948

EX_USAGE.

usr.bin/netstat/netisr.c
234

EX_OSERR

usr.bin/netstat/nhgrp.c
214

EX_OSERR

216

EX_OSERR

usr.bin/netstat/nhops.c
215

EX_OSERR

357

EX_OSERR

359

EX_OSERR

usr.bin/netstat/route_netlink.c
106

EX_OSERR

des requested changes to this revision.Aug 17 2023, 3:58 PM
This revision now requires changes to proceed.Aug 17 2023, 3:58 PM
usr.bin/netstat/main.c
927

There is no need for a cast as xo_error() does not return anything.

usr.bin/netstat/main.c
464

main.c doesn't include sysexits.h. And most of the codes use the number instead of EXIT_ string. I may use the number style here to avoid too much change.

In some files sysexit.h is not include (below lists), I use the number style there to avoid much change.

a. main.c
b. netisr.c

The above has sysexit.h use EX_ string.

a. common.c
b. if.c
c. nhgrp.c
d. nhops.c
e. route.c
f. route_netlink.c
f. route_netlink.c
  • Use EX_ string from sysexits.h if the file include it.
des requested changes to this revision.Aug 19 2023, 1:38 PM

Please don't mix and match. Pick a style and stick to it throughout the program.

This revision now requires changes to proceed.Aug 19 2023, 1:38 PM
  • Using sysexits.h string in all the files.

Thank you for going the extra mile. Remember to mark my comments as done next time :) You may have to press “Submit” twice, because Phabricator is kinda dumb.

usr.bin/netstat/main.c
623–625

If you want, you can add a label here and replace every earlier occurrence of this and the next two lines with a goto to that label. But it's also fine as-is.

This revision is now accepted and ready to land.Aug 26 2023, 11:59 PM
This revision was automatically updated to reflect the committed changes.