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

Add type definitions for riscv64 FreeBSD #1652

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

clausecker
Copy link

For #1425. This enables gopsutil to work on riscv64 FreeBSD.

I also fixed an include directive so mktypes.sh would succeed.

This makes mktypes.sh succeed on FreeBSD.

For shirou#1425
Generated on 15-CURRENT 5d62025d82a0.

Fixes shirou#1425.
@clausecker
Copy link
Author

Currently fixing some bugs with the patch set. The Tv field in Utmpx should be a Timeval (which is a structure), but it's an uint64 in all the files for some reason. This is wrong and will lead to wrong results. Apparently this was changed in 2fd3f03 and I don't know why.

@clausecker
Copy link
Author

Also note that the utmp structure no longer exists, it appears to be a legacy of FreeBSD 9.

@shirou
Copy link
Owner

shirou commented May 24, 2024

Thank you for your contribution! So are you still trying to edit this PR related to Tv in Utmpx? Then, we will wait to approve.

Also note that the utmp structure no longer exists, it appears to be a legacy of FreeBSD 9.

Yes, it is just for a compatibility. But, perhaps, we can remove because FreeBSD 9 was released 10 years ago.

@clausecker
Copy link
Author

So are you still trying to edit this PR related to Tv in Utmpx?

I'm not sure what to do here. The Tv field is wrong on the other 64 bit architectures, too. It is always a structure, not a 64 bit integer. If I was to fix the behaviour of this field for riscv64, I would have to touch all other architectures, too.

Yes, it is just for a compatibility. But, perhaps, we can remove because FreeBSD 9 was released 10 years ago.

Maybe that would be a good idea indeed.

@shirou
Copy link
Owner

shirou commented May 28, 2024

When I run build test by GOOS=freebsd GOARCH=riscv64 go test ./..., build was failed on host.

host/host_freebsd_riscv64.go:26:8: undefined: _cgopackage
host/host_freebsd.go:73:31: u.Tv undefined (type Utmpx has no field or method Tv)

I found #709 and remember why freebsd_headers is included and Tv is not a struct.

Regarding the u.Tv undefined error in utmpx.Tv, it seems that uint64_t in utxdb.h cannot be resolved, resulting in Pad_cgo_0. I have tried various approaches to solve this issue, but it also results in Pad_cgo_0 on amd64. Do you have any idea why this is happening? I believe it was not an issue when it was generated in the past.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants