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

Use C99 format macro constants for timestamp and vlan_tag #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jefferyto
Copy link
Contributor

Since timestamp and vlan_tag in the shm_log_entry struct are C99 fixed width integer types (uint64_t and uint16_t), the cross-platform way to print these values is to use the corresponding format macro constants, PRIu64 and PRIu16.

This also adjusts the places where the time_t timestamp value is printed, casting it to uint64_t, for consistency.

Fixes #25
Fixes #26

jefferyto added a commit to jefferyto/openwrt-packages that referenced this pull request Jul 4, 2021
Makefile changes include:

* Remove USE_UCLIBC, as uclibc is no longer supported

* Package output modules

* Move main binary (back) to /usr/sbin, as it is system administration
  related and requires superuser privileges

New patches:

* 003-add-space-for-null-byte.patch - from
  fln/addrwatch@374cfd2

* 004-more-specific-library-linking.patch - from
  fln/addrwatch@27b57d9

* 005-use-c99-format-macro-constants.patch - from
  fln/addrwatch#28

Init script changes include:

* Change from explicit disable to explicit enable, so that the service
  is disabled by default and on first install

* Set config option default values to default values of the main binary

* Fix command-line option names and format (from
  https://forum.openwrt.org/t/cant-start-addrwatch-service/60499/3)

* Always use the --quiet command-line option, as the procd instance is
  not configured to capture stdout/stderr

* Change the syslog config option to start the syslog output module

Signed-off-by: Jeffery To <[email protected]>
Since timestamp and vlan_tag in the shm_log_entry struct are C99 fixed
width integer types (uint64_t and uint16_t), the cross-platform way to
print these values is to use the corresponding format macro
constants[1], PRIu64 and PRIu16.

This also adjusts the places where the time_t timestamp value is
printed, casting it to uint64_t, for consistency.

Fixes fln#25
Fixes fln#26

[1]: https://en.cppreference.com/w/c/types/integer#Format_macro_constants
@jefferyto jefferyto force-pushed the use-c99-format-macro-constants branch from b49c70f to 11f224b Compare July 6, 2021 16:14
jefferyto added a commit to jefferyto/openwrt-packages that referenced this pull request Jul 6, 2021
Makefile changes include:

* Remove USE_UCLIBC, as uclibc is no longer supported

* Package output modules

* Move main binary (back) to /usr/sbin, as it is system administration
  related and requires superuser privileges

New patches:

* 003-add-space-for-null-byte.patch - from
  fln/addrwatch@374cfd2

* 004-more-specific-library-linking.patch - from
  fln/addrwatch@27b57d9

* 005-use-c99-format-macro-constants.patch - from
  fln/addrwatch#28

Init script changes include:

* Change from explicit disable to explicit enable, so that the service
  is disabled by default and on first install

* Set config option default values to default values of the main binary

* Fix command-line option names and format (from
  https://forum.openwrt.org/t/cant-start-addrwatch-service/60499/3)

* Always use the --quiet command-line option, as the procd instance is
  not configured to capture stdout/stderr

* Change the syslog config option to start the syslog output module

Signed-off-by: Jeffery To <[email protected]>
jefferyto added a commit to jefferyto/openwrt-packages that referenced this pull request Jul 15, 2021
Makefile changes include:

* Remove USE_UCLIBC, as uclibc is no longer supported

* Package output modules

* Move main binary (back) to /usr/sbin, as it is system administration
  related and requires superuser privileges

New patches:

* 003-add-space-for-null-byte.patch - from
  fln/addrwatch@374cfd2

* 004-more-specific-library-linking.patch - from
  fln/addrwatch@27b57d9

* 005-use-c99-format-macro-constants.patch - from
  fln/addrwatch#28

Init script changes include:

* Change from explicit disable to explicit enable, so that the service
  is disabled by default and on first install

* Set config option default values to default values of the main binary

* Fix command-line option names and format (from
  https://forum.openwrt.org/t/cant-start-addrwatch-service/60499/3)

* Always use the --quiet command-line option, as the procd instance is
  not configured to capture stdout/stderr

* Change the syslog config option to start the syslog output module

Signed-off-by: Jeffery To <[email protected]>
(cherry picked from commit 31ae85b)
1715173329 pushed a commit to immortalwrt/packages that referenced this pull request Jul 15, 2021
Makefile changes include:

* Remove USE_UCLIBC, as uclibc is no longer supported

* Package output modules

* Move main binary (back) to /usr/sbin, as it is system administration
  related and requires superuser privileges

New patches:

* 003-add-space-for-null-byte.patch - from
  fln/addrwatch@374cfd2

* 004-more-specific-library-linking.patch - from
  fln/addrwatch@27b57d9

* 005-use-c99-format-macro-constants.patch - from
  fln/addrwatch#28

Init script changes include:

* Change from explicit disable to explicit enable, so that the service
  is disabled by default and on first install

* Set config option default values to default values of the main binary

* Fix command-line option names and format (from
  https://forum.openwrt.org/t/cant-start-addrwatch-service/60499/3)

* Always use the --quiet command-line option, as the procd instance is
  not configured to capture stdout/stderr

* Change the syslog config option to start the syslog output module

Signed-off-by: Jeffery To <[email protected]>
Signed-off-by: Tianling Shen <[email protected]>
jefferyto added a commit to jefferyto/openwrt-packages that referenced this pull request Jul 15, 2021
Makefile changes include:

* Include syslog output module

* Move main binary (back) to /usr/sbin, as it is system administration
  related and requires superuser privileges

New patches:

* 003-add-space-for-null-byte.patch - from
  fln/addrwatch@374cfd2

* 004-more-specific-library-linking.patch - from
  fln/addrwatch@27b57d9

* 005-use-c99-format-macro-constants.patch - from
  fln/addrwatch#28

Init script changes include:

* Fix command-line option names and format (from
  https://forum.openwrt.org/t/cant-start-addrwatch-service/60499/3)

* Always use the --quiet command-line option, as the procd instance is
  not configured to capture stdout/stderr

* Change the syslog config option to start the syslog output module

Signed-off-by: Jeffery To <[email protected]>
utoni pushed a commit to utoni/openwrt-packages that referenced this pull request Jan 21, 2022
Makefile changes include:

* Remove USE_UCLIBC, as uclibc is no longer supported

* Package output modules

* Move main binary (back) to /usr/sbin, as it is system administration
  related and requires superuser privileges

New patches:

* 003-add-space-for-null-byte.patch - from
  fln/addrwatch@374cfd2

* 004-more-specific-library-linking.patch - from
  fln/addrwatch@27b57d9

* 005-use-c99-format-macro-constants.patch - from
  fln/addrwatch#28

Init script changes include:

* Change from explicit disable to explicit enable, so that the service
  is disabled by default and on first install

* Set config option default values to default values of the main binary

* Fix command-line option names and format (from
  https://forum.openwrt.org/t/cant-start-addrwatch-service/60499/3)

* Always use the --quiet command-line option, as the procd instance is
  not configured to capture stdout/stderr

* Change the syslog config option to start the syslog output module

Signed-off-by: Jeffery To <[email protected]>
1582130940 pushed a commit to 1582130940/OpenWrt-Lean-Packages that referenced this pull request Nov 10, 2022
Makefile changes include:

* Remove USE_UCLIBC, as uclibc is no longer supported

* Package output modules

* Move main binary (back) to /usr/sbin, as it is system administration
  related and requires superuser privileges

New patches:

* 003-add-space-for-null-byte.patch - from
  fln/addrwatch@374cfd2

* 004-more-specific-library-linking.patch - from
  fln/addrwatch@27b57d9

* 005-use-c99-format-macro-constants.patch - from
  fln/addrwatch#28

Init script changes include:

* Change from explicit disable to explicit enable, so that the service
  is disabled by default and on first install

* Set config option default values to default values of the main binary

* Fix command-line option names and format (from
  https://forum.openwrt.org/t/cant-start-addrwatch-service/60499/3)

* Always use the --quiet command-line option, as the procd instance is
  not configured to capture stdout/stderr

* Change the syslog config option to start the syslog output module

Signed-off-by: Jeffery To <[email protected]>
1582130940 pushed a commit to 1582130940/OpenWrt-Lean-Packages that referenced this pull request Nov 10, 2022
Makefile changes include:

* Remove USE_UCLIBC, as uclibc is no longer supported

* Package output modules

* Move main binary (back) to /usr/sbin, as it is system administration
  related and requires superuser privileges

New patches:

* 003-add-space-for-null-byte.patch - from
  fln/addrwatch@374cfd2

* 004-more-specific-library-linking.patch - from
  fln/addrwatch@27b57d9

* 005-use-c99-format-macro-constants.patch - from
  fln/addrwatch#28

Init script changes include:

* Change from explicit disable to explicit enable, so that the service
  is disabled by default and on first install

* Set config option default values to default values of the main binary

* Fix command-line option names and format (from
  https://forum.openwrt.org/t/cant-start-addrwatch-service/60499/3)

* Always use the --quiet command-line option, as the procd instance is
  not configured to capture stdout/stderr

* Change the syslog config option to start the syslog output module

Signed-off-by: Jeffery To <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

addrwatch_stdout segfaults on first update Null/incorrect values logged by addrwatch_syslog
1 participant