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

[host][linux]: fix utmp size on linux/arm64 #1603

Merged
merged 3 commits into from Mar 4, 2024

Conversation

shirou
Copy link
Owner

@shirou shirou commented Mar 2, 2024

fix: #1129

Update host_linux_arm64.go with below environment

Note: type file has been changed by hand

uint -> int

The cgo command output []uint in arm64. But it is []int, at least on amd64. This difference caused build to fail on arm64.

There is a technique to use generics, but I changed it by editing the arm64 definition from uint to int by hand, in order to keep backward compatibility.

added padding after type

padding is required for parse.

Generated code is uint8 on arm64. However, it is not same as other archtectures.
This commit changes by hand.
@shirou shirou force-pushed the feat/host_linux_fix_arm64_utmp_size branch from d63874e to cfb7a5d Compare March 2, 2024 04:22
@shirou shirou marked this pull request as ready for review March 2, 2024 04:27
@JosefRypacek
Copy link

Tested on aarch64. It works somehow, but I'm not sure if the output is correct.

root@s1:~/go-test# cat test.go 
package main

import (
    "fmt"
    "github.com/shirou/gopsutil/v3/host"
)

func main() {
    fmt.Println(host.Users())
}
root@s1:~/go-test# go run test.go 
[{"user":"/0jrypacek","terminal":"","host":"","started":112033681178624} {"user":"/1jrypacek","terminal":"","host":"","started":112033693171712}] <nil>

root@s1:~/go-test# who
jrypacek pts/0        2024-03-03 21:38 (1.2.3.4)
jrypacek pts/1        2024-03-03 21:41 (1.2.3.4)

@shirou
Copy link
Owner Author

shirou commented Mar 4, 2024

@JosefRypacek Thank you for your quick confirmation. I found a padding was missing. I added it on
cbefbb0. Sorry to bother you, but could you try again?

@JosefRypacek
Copy link

Works better now. Thanks!

root@s1:~/go-test# go run test.go 
[{"user":"jrypacek","terminal":"pts/0","host":"1.2.3.4","started":1709564619} {"user":"jrypacek","terminal":"pts/1","host":"1.2.3.4","started":1709564625}] <nil>

@shirou shirou merged commit 5b2dd59 into master Mar 4, 2024
45 checks passed
@shirou shirou deleted the feat/host_linux_fix_arm64_utmp_size branch March 4, 2024 15:57
dmitryax pushed a commit to open-telemetry/opentelemetry-collector that referenced this pull request Apr 2, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [github.com/shirou/gopsutil/v3](https://togithub.com/shirou/gopsutil)
| `v3.24.2` -> `v3.24.3` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fshirou%2fgopsutil%2fv3/v3.24.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fshirou%2fgopsutil%2fv3/v3.24.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fshirou%2fgopsutil%2fv3/v3.24.2/v3.24.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fshirou%2fgopsutil%2fv3/v3.24.2/v3.24.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>shirou/gopsutil (github.com/shirou/gopsutil/v3)</summary>

###
[`v3.24.3`](https://togithub.com/shirou/gopsutil/releases/tag/v3.24.3)

[Compare
Source](https://togithub.com/shirou/gopsutil/compare/v3.24.2...v3.24.3)

<!-- Release notes generated using configuration in .github/release.yml
at v3.24.3 -->

#### What's Changed

##### disk

- chore: fix typo by
[@&#8203;majorteach](https://togithub.com/majorteach) in
[shirou/gopsutil#1615

##### host

- \[host]\[linux]: fix utmp size on linux/arm64 by
[@&#8203;shirou](https://togithub.com/shirou) in
[shirou/gopsutil#1603

##### load

- Total Processes in `MiscStat` Corrected by
[@&#8203;eric1234](https://togithub.com/eric1234) in
[shirou/gopsutil#1612

##### process

- \[process]\[freebsd]: re-generate types on freebsd arm64 by
[@&#8203;shirou](https://togithub.com/shirou) in
[shirou/gopsutil#1609

#### New Contributors

- [@&#8203;majorteach](https://togithub.com/majorteach) made their first
contribution in
[shirou/gopsutil#1615
- [@&#8203;eric1234](https://togithub.com/eric1234) made their first
contribution in
[shirou/gopsutil#1612

**Full Changelog**:
shirou/gopsutil@v3.24.2...v3.24.3

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "on tuesday" (UTC), Automerge - At any
time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/open-telemetry/opentelemetry-collector).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yNjkuMiIsInVwZGF0ZWRJblZlciI6IjM3LjI2OS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: opentelemetrybot <107717825+opentelemetrybot@users.noreply.github.com>
mx-psi pushed a commit to open-telemetry/opentelemetry-collector-contrib that referenced this pull request Apr 2, 2024
…2096)

[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [github.com/shirou/gopsutil/v3](https://togithub.com/shirou/gopsutil)
| `v3.24.2` -> `v3.24.3` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fshirou%2fgopsutil%2fv3/v3.24.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fshirou%2fgopsutil%2fv3/v3.24.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fshirou%2fgopsutil%2fv3/v3.24.2/v3.24.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fshirou%2fgopsutil%2fv3/v3.24.2/v3.24.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>shirou/gopsutil (github.com/shirou/gopsutil/v3)</summary>

###
[`v3.24.3`](https://togithub.com/shirou/gopsutil/releases/tag/v3.24.3)

[Compare
Source](https://togithub.com/shirou/gopsutil/compare/v3.24.2...v3.24.3)

<!-- Release notes generated using configuration in .github/release.yml
at v3.24.3 -->

#### What's Changed

##### disk

- chore: fix typo by
[@&#8203;majorteach](https://togithub.com/majorteach) in
[shirou/gopsutil#1615

##### host

- \[host]\[linux]: fix utmp size on linux/arm64 by
[@&#8203;shirou](https://togithub.com/shirou) in
[shirou/gopsutil#1603

##### load

- Total Processes in `MiscStat` Corrected by
[@&#8203;eric1234](https://togithub.com/eric1234) in
[shirou/gopsutil#1612

##### process

- \[process]\[freebsd]: re-generate types on freebsd arm64 by
[@&#8203;shirou](https://togithub.com/shirou) in
[shirou/gopsutil#1609

#### New Contributors

- [@&#8203;majorteach](https://togithub.com/majorteach) made their first
contribution in
[shirou/gopsutil#1615
- [@&#8203;eric1234](https://togithub.com/eric1234) made their first
contribution in
[shirou/gopsutil#1612

**Full Changelog**:
shirou/gopsutil@v3.24.2...v3.24.3

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "on tuesday" (UTC), Automerge - At any
time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/open-telemetry/opentelemetry-collector-contrib).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yNjkuMiIsInVwZGF0ZWRJblZlciI6IjM3LjI2OS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: opentelemetrybot <107717825+opentelemetrybot@users.noreply.github.com>
ycombinator pushed a commit to ycombinator/opentelemetry-collector-contrib that referenced this pull request Apr 9, 2024
…en-telemetry#32096)

[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [github.com/shirou/gopsutil/v3](https://togithub.com/shirou/gopsutil)
| `v3.24.2` -> `v3.24.3` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fshirou%2fgopsutil%2fv3/v3.24.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fshirou%2fgopsutil%2fv3/v3.24.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fshirou%2fgopsutil%2fv3/v3.24.2/v3.24.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fshirou%2fgopsutil%2fv3/v3.24.2/v3.24.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>shirou/gopsutil (github.com/shirou/gopsutil/v3)</summary>

###
[`v3.24.3`](https://togithub.com/shirou/gopsutil/releases/tag/v3.24.3)

[Compare
Source](https://togithub.com/shirou/gopsutil/compare/v3.24.2...v3.24.3)

<!-- Release notes generated using configuration in .github/release.yml
at v3.24.3 -->

#### What's Changed

##### disk

- chore: fix typo by
[@&open-telemetry#8203;majorteach](https://togithub.com/majorteach) in
[shirou/gopsutil#1615

##### host

- \[host]\[linux]: fix utmp size on linux/arm64 by
[@&open-telemetry#8203;shirou](https://togithub.com/shirou) in
[shirou/gopsutil#1603

##### load

- Total Processes in `MiscStat` Corrected by
[@&open-telemetry#8203;eric1234](https://togithub.com/eric1234) in
[shirou/gopsutil#1612

##### process

- \[process]\[freebsd]: re-generate types on freebsd arm64 by
[@&open-telemetry#8203;shirou](https://togithub.com/shirou) in
[shirou/gopsutil#1609

#### New Contributors

- [@&open-telemetry#8203;majorteach](https://togithub.com/majorteach) made their first
contribution in
[shirou/gopsutil#1615
- [@&open-telemetry#8203;eric1234](https://togithub.com/eric1234) made their first
contribution in
[shirou/gopsutil#1612

**Full Changelog**:
shirou/gopsutil@v3.24.2...v3.24.3

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "on tuesday" (UTC), Automerge - At any
time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/open-telemetry/opentelemetry-collector-contrib).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yNjkuMiIsInVwZGF0ZWRJblZlciI6IjM3LjI2OS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: opentelemetrybot <107717825+opentelemetrybot@users.noreply.github.com>
rimitchell pushed a commit to rimitchell/opentelemetry-collector-contrib that referenced this pull request May 8, 2024
…en-telemetry#32096)

[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [github.com/shirou/gopsutil/v3](https://togithub.com/shirou/gopsutil)
| `v3.24.2` -> `v3.24.3` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fshirou%2fgopsutil%2fv3/v3.24.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fshirou%2fgopsutil%2fv3/v3.24.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fshirou%2fgopsutil%2fv3/v3.24.2/v3.24.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fshirou%2fgopsutil%2fv3/v3.24.2/v3.24.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>shirou/gopsutil (github.com/shirou/gopsutil/v3)</summary>

###
[`v3.24.3`](https://togithub.com/shirou/gopsutil/releases/tag/v3.24.3)

[Compare
Source](https://togithub.com/shirou/gopsutil/compare/v3.24.2...v3.24.3)

<!-- Release notes generated using configuration in .github/release.yml
at v3.24.3 -->

#### What's Changed

##### disk

- chore: fix typo by
[@&open-telemetry#8203;majorteach](https://togithub.com/majorteach) in
[shirou/gopsutil#1615

##### host

- \[host]\[linux]: fix utmp size on linux/arm64 by
[@&open-telemetry#8203;shirou](https://togithub.com/shirou) in
[shirou/gopsutil#1603

##### load

- Total Processes in `MiscStat` Corrected by
[@&open-telemetry#8203;eric1234](https://togithub.com/eric1234) in
[shirou/gopsutil#1612

##### process

- \[process]\[freebsd]: re-generate types on freebsd arm64 by
[@&open-telemetry#8203;shirou](https://togithub.com/shirou) in
[shirou/gopsutil#1609

#### New Contributors

- [@&open-telemetry#8203;majorteach](https://togithub.com/majorteach) made their first
contribution in
[shirou/gopsutil#1615
- [@&open-telemetry#8203;eric1234](https://togithub.com/eric1234) made their first
contribution in
[shirou/gopsutil#1612

**Full Changelog**:
shirou/gopsutil@v3.24.2...v3.24.3

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "on tuesday" (UTC), Automerge - At any
time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/open-telemetry/opentelemetry-collector-contrib).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yNjkuMiIsInVwZGF0ZWRJblZlciI6IjM3LjI2OS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: opentelemetrybot <107717825+opentelemetrybot@users.noreply.github.com>
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.

host.Users() cannot get information on arm64
2 participants