Skip to content

pppd: On 32-bit Linux <3.8 force to ioctl() counters.#580

Merged
paulusmack merged 1 commit into
ppp-project:masterfrom
jkroonza:counters-64bit-on-32bit-old
Apr 2, 2026
Merged

pppd: On 32-bit Linux <3.8 force to ioctl() counters.#580
paulusmack merged 1 commit into
ppp-project:masterfrom
jkroonza:counters-64bit-on-32bit-old

Conversation

@jkroonza
Copy link
Copy Markdown
Contributor

@jkroonza jkroonza commented Apr 1, 2026

This is to enable detecting wrap-around, and the sysfs overhead serves no purpose since they don't contain 64-bit counters either way.

This assumes sizeof(long) is dictated by the word size for all arches, ie, sizeof(long) == 4 for all 32-bit arches, and sizeof(long) == 8 for all 64-bit arches.

Closes: #578

Copy link
Copy Markdown
Collaborator

@paulusmack paulusmack left a comment

Choose a reason for hiding this comment

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

Basically looks fine.

Comment thread pppd/sys-linux.c Outdated
Comment thread pppd/sys-linux.c Outdated
static int (*func)(int, struct pppd_stats*) = NULL;

if (!func) {
#if (SIZEOF_UNSIGNED_LONG == 4)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm curious whether SIZEOF_UNSIGNED_LONG could ever be different from sizeof(unsigned long).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The problem is you can't #if sizeof(T) ... because T isn't a pre-processor construct. Tried this first :).

@jkroonza jkroonza force-pushed the counters-64bit-on-32bit-old branch from 1d29daf to 13c4c28 Compare April 1, 2026 07:59
This is to enable detecting wrap-around, and the sysfs overhead serves
no purpose since they don't contain 64-bit counters either way.

This assumes sizeof(long) is dictated by the word size for all arches,
ie, sizeof(long) == 4 for all 32-bit arches, and sizeof(long) == 8 for
all 64-bit arches.

Closes: ppp-project#578
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
@jkroonza jkroonza force-pushed the counters-64bit-on-32bit-old branch from 13c4c28 to ef8facc Compare April 1, 2026 19:40
@paulusmack paulusmack merged commit 3b6c011 into ppp-project:master Apr 2, 2026
31 checks passed
@paulusmack
Copy link
Copy Markdown
Collaborator

Thanks. I edited the description to reflect the fact that the architectural word size is actually irrelevant.

@jkroonza
Copy link
Copy Markdown
Contributor Author

jkroonza commented Apr 2, 2026

Thanks. I edited the description to reflect the fact that the architectural word size is actually irrelevant.

Thank you!

@Neustradamus
Copy link
Copy Markdown
Member

@jkroonza: Thanks for your PR and @paulusmack for merging!

@jkroonza jkroonza deleted the counters-64bit-on-32bit-old branch April 2, 2026 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

64-bit counters stopped working on 32-bit kernel after pull #298

3 participants