Page MenuHomeFreeBSD

Cleanup sctp_syscalls.c
ClosedPublic

Authored by tuexen on Jul 12 2020, 3:09 PM.

Details

Summary

The original pattern of an SCTP syscall was

int syscall_name (td, uap)
{
#if (defined(INET) || defined(INET6)) && defined(SCTP)
  body
  return (error);
#else
  return (EOPNOTSUPP);
#endif
}

This was changed in r 363079

int syscall_name (td, uap)
{
#if defined(INET) || defined(INET6)
  body
  return (error);
#endif
}

This does not work when neither INET nor INET6 is defined, since the function is expected to return an int. I think this file is not intended to be compiled in this case, therefore I propose to remove the #ifdefs.

sys/conf/files contains

netinet/sctp_syscalls.c		optional inet sctp | inet6 sctp

and the SCTP module should also not be compiled on a kernel not supporting INET and not supporting INET6.

If the above analysis is not correct, one needs to re-add some #else clauses.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

markj added inline comments.
sys/netinet/sctp_syscalls.c
35 ↗(On Diff #74358)

Do we still need opt_sctp.h?

sys/netinet/sctp_syscalls.c
35 ↗(On Diff #74358)

Isn't it needed for the #ifdef SCTP I just re-added to register the syscalls?

sys/netinet/sctp_syscalls.c
35 ↗(On Diff #74358)

Indeed, I was looking at the previous revision of this file.

This revision was not accepted when it landed; it landed in state Needs Review.Jul 12 2020, 6:34 PM
This revision was automatically updated to reflect the committed changes.