stratum / stratum

Stratum is an open source silicon-independent switch operating system for software defined networks.
https://www.opennetworking.org/stratum/
Apache License 2.0
392 stars 135 forks source link

Remove dependency on Linux in gNOI Admin Service #843

Closed bocon13 closed 2 years ago

bocon13 commented 3 years ago

Stratum currently depends on Linux headers, which means it can't be built natively on Mac.

For example,

warning: unknown warning option '-Werror=maybe-uninitialized'; did you mean '-Werror=uninitialized'? [-Wunknown-warning-option]
stratum/hal/lib/common/admin_utils.cc:5:10: fatal error: 'linux/reboot.h' file not found
#include <linux/reboot.h>
         ^~~~~~~~~~~~~~~~
1 warning and 1 error generated.

We can use platform defines (e.g. __linux__) to help identify the target, so we can use Bazel to determine on a target by target basis what the behavior should be with a select and some custom defines.

For example, we probably don't want want to reboot the machine for stratum_dummy or stratum_bmv2, but we could kill the process.

On Mac in general, we probably just want to return gRPC UNIMPLENTED (instead of rebooting the developer machine).


There's also a dependency in hal.cc:

In file included from stratum/hal/lib/common/hal.cc:5:
./stratum/hal/lib/common/hal.h:156:28: error: use of undeclared identifier 'sighandler_t'
  absl::flat_hash_map<int, sighandler_t> old_signal_handlers_;

This might have some hints on how to address the signal handler issue: https://github.com/MichaelSasser/pdfcrack-ng/pull/2/files

Michaellin250 commented 3 years ago

Can I take on this issue? :) First time contributing In a while!

bocon13 commented 3 years ago

@Michaellin250 Go for it! Please let us know if the issue or objective isn't clear enough, and we can provide more details/guidance.

Michaellin250 commented 3 years ago

Hi. I did a pull request and made the change. Let me know if it works!!

pudelkoM commented 2 years ago

Fixed by #1013