Fabian Grünbichler
43b4440ef0
sys: bump log dependency
...
to ensure format strings with "{var}" work properly.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-05-16 15:50:50 +02:00
Thomas Lamprecht
9c0e9dca59
tree wide update of genereated control
...
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-05-05 10:22:50 +02:00
Thomas Lamprecht
4cdeee64dc
sys: make acl constants rustfmt safe
...
there's not much better one can do here..
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-04-10 17:39:31 +02:00
Thomas Lamprecht
0a651e00a9
sys: rust fmt
...
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-04-10 17:39:31 +02:00
Wolfgang Bumiller
d663ff328a
formatting fixup
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-02-21 13:49:48 +01:00
Wolfgang Bumiller
57d052af36
workspace: set proxmox-lang dep version to 1.1
...
to ensure the error macros are available
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-02-21 13:45:46 +01:00
Dominik Csapak
d4b4115400
move io error helpers to proxmox-lang
...
this removes proxmox_sys as a dependecy for proxmox-async
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-02-21 13:35:14 +01:00
Fabian Grünbichler
ca563a8cfd
misc clippy fixes
...
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-02-08 14:28:44 +01:00
Dominik Csapak
e428920a15
proxmox-sys: add FileSystemInformation struct and helper
...
code mostly copied from proxmox-backups 'disk_usage'
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2022-02-01 12:26:14 +01:00
Dominik Csapak
131f3d9471
proxmox-sys: make some structs serializable
...
we already depend on serde anyway, and this makes gathering structs a
bit more comfortable
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2022-02-01 12:26:14 +01:00
Fabian Grünbichler
540fb905c2
sys: make xattr tests integration tests
...
these touch files, so should use the cargo-provided tmp dir, but that is
only available to benchmarks and integration tests, not unit tests.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2021-12-30 11:51:08 +01:00
Fabian Grünbichler
e8cb382442
add missing library dependencies
...
without these, the generated d/control files are incomplete and builds
fail on clean systems.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2021-12-30 11:51:08 +01:00
Thomas Lamprecht
61cd0ac2ba
proxmox-sys: fix glob-import of anyhow
...
will break usage of the `Result::Ok()' with anyhow 1.0.49+ as that
added a new Ok helper, so a glob-import would make that shadow the
core one.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-12-13 07:46:34 +01:00
Wolfgang Bumiller
59986f1195
sys: another minor clippy fix
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-12-07 11:43:28 +01:00
Wolfgang Bumiller
b213dbb7c8
sys: formatting
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-12-07 11:42:53 +01:00
Wolfgang Bumiller
c280f73793
sys: clippy fixes
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-12-07 11:42:53 +01:00
Fabian Grünbichler
6bb932e604
use nix::unistd::fchown
...
instead of re-implementing it, now that we depend on >=0.19
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2021-12-02 09:04:55 +01:00
Fabian Grünbichler
1db9a5bc0e
clippy: allow manual_range_contains
...
we use it quite often in this module, and it's more readable when split.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2021-12-02 09:04:55 +01:00
Fabian Grünbichler
e303ad8605
clippy: misc fixes
...
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2021-12-02 09:00:52 +01:00
Wolfgang Bumiller
eac7ebfc55
sys: add back d/control
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-11-29 11:35:39 +01:00
Wolfgang Bumiller
30e99fef5b
bump proxmox-sys to 0.2.2
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-11-29 11:33:42 +01:00
Wolfgang Bumiller
35ecf9a551
sys: deprecate the identity macro
...
to be removed with the next major version bump
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-11-29 11:31:39 +01:00
Wolfgang Bumiller
9dcc229491
sys: depend on sortable-macro 0.1.2
...
drops the requirement for the identity macro
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-11-29 11:30:06 +01:00
Wolfgang Bumiller
3891953724
proxmox-sys: fix a warning in io_bail_last macro
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-11-29 11:29:31 +01:00
Dietmar Maurer
248e888ae7
cleanup: avoid use anyhow::*
...
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-28 12:50:59 +01:00
Dietmar Maurer
10ad340322
bump proxmox-sys version to 0.2.1
...
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-25 12:12:35 +01:00
Dietmar Maurer
80df41a887
proxmox-sys: import pipe() function from pbs-toos/src/io.rs
...
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-25 10:34:33 +01:00
Dietmar Maurer
82245339b8
use new proxmox-sys 0.2.0 for all crates
...
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-24 10:00:38 +01:00
Dietmar Maurer
dace74a556
bump proxmox-sys version to 0.2.0
...
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-24 10:00:38 +01:00
Dietmar Maurer
b06807532e
proxmox-sys: add stortable-macro feature and remove it from proxmox
...
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-24 10:00:38 +01:00
Dietmar Maurer
ee4e56e372
proxmox-sys: moved nodename from proxmox crate
...
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-24 10:00:38 +01:00
Dietmar Maurer
ec3965fdad
proxmox-sys: fix regression tests
2021-11-24 10:00:38 +01:00
Dietmar Maurer
21686c99e6
proxmox-sys: fixup worker task log macros
2021-11-24 10:00:38 +01:00
Dietmar Maurer
6efbe4e6e8
proxmox-sys: imported proxmox/src/tools/systemd.rs
...
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-24 10:00:38 +01:00
Dietmar Maurer
ba1f59c098
proxmox-sys: imported proxmox/src/tools/email.rs
...
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-24 10:00:38 +01:00
Dietmar Maurer
0806020ebf
proxmox-sys: improve dev docs
...
And move WorkerTaskContext to top level.
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-24 10:00:38 +01:00
Dietmar Maurer
e011964f81
proxmox-sys: imported pbs-tools/src/command.rs
...
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-24 10:00:38 +01:00
Dietmar Maurer
4c7bd0ee50
proxmox-sys: imported pbs-tools/src/acl.rs
...
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-24 10:00:38 +01:00
Dietmar Maurer
66aea897b6
proxmox-sys: imported pbs-tool/src/xattr.rs
2021-11-24 10:00:38 +01:00
Dietmar Maurer
d98ed51fa8
proxmox-sys: move file_get_non_comment_lines to src/fs/file.rs
...
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-24 10:00:38 +01:00
Dietmar Maurer
92caf51634
proxmox-sys: split xattr code into extra file
...
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-24 10:00:38 +01:00
Dietmar Maurer
d0b7e1e299
proxmox-sys: imported pbs-tools/src/fs.rs to src/fs/read_dir.rs
...
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-24 10:00:38 +01:00
Dietmar Maurer
32b69176dd
proxmox-sys: imported proxmox tools/sys
...
And split some files into smaller parts.
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-24 10:00:38 +01:00
Dietmar Maurer
c0312f3717
bum proxmox-sys version to 0.1.2
...
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-22 10:35:45 +01:00
Dietmar Maurer
4d158ec1b3
proxmox-sys: fix test for wrong logrotate path
...
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-22 10:35:45 +01:00
Dietmar Maurer
45645d9aee
proxmox-sys: add copyright file
...
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-19 15:48:18 +01:00
Fabian Grünbichler
5ecc7724e2
sys: update d/control
...
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2021-11-19 12:12:01 +01:00
Fabian Grünbichler
d49e6a362e
bump proxmox-sys to 0.1.1
...
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2021-11-19 12:05:48 +01:00
Fabian Grünbichler
aedc5197f5
sys: add missing file
...
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2021-11-19 12:05:48 +01:00
Fabian Grünbichler
dc14d03171
all crates: bump base64 dep to 0.13
...
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2021-11-19 11:46:21 +01:00
Dietmar Maurer
20661f014d
proxmox-sys: imported pbs-tools/src/task.rs (as worker_task_context.rs)
...
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-19 10:05:06 +01:00
Dietmar Maurer
202641757e
proxmox-sys: imported pbs-tools/src/logrotate.rs (with various cleanups)
...
- new: CreateOption s instead of owner string
- new: returns Result instead of Option
- new: add max_files option
- remove new_with_user()
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-19 09:28:59 +01:00
Dietmar Maurer
8ac4c949bb
proxmox-sys: imported pbs-tools/src/process_locker.rs
...
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-19 09:28:52 +01:00
Dietmar Maurer
840154f61b
proxmox-sys: add new crate
...
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-19 09:28:32 +01:00
Wolfgang Bumiller
436bf05e0b
merge api, sys and tools into proxmox directly
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-21 12:15:42 +01:00
Wolfgang Bumiller
2ef0e795a7
sys: double-parse fixup
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-17 13:32:21 +01:00
Wolfgang Bumiller
df5eb296cc
sys: mountinfo parsing fixups
...
* include the failing line on errors
* don't fail on the final empty line...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-17 13:30:28 +01:00
Wolfgang Bumiller
3d9fdb5634
bump sys crate
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-16 11:36:41 +01:00
Wolfgang Bumiller
eeb8e7f839
sys: read_for_pid -> read_from_pid, drop deprecated functions
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-16 11:33:42 +01:00
Wolfgang Bumiller
4dc4bb91ad
bump proxmox-sys to 0.1.2
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-15 15:34:26 +01:00
Fabian Grünbichler
a94de245f0
build: switch to debcargo
...
to autogenerate crate (build)-dependencies, and correct Provides
statements.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-01-15 12:02:47 +01:00
Wolfgang Bumiller
a01491036c
sys: add pid module with PidFd type
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-15 10:57:11 +01:00
Wolfgang Bumiller
20fe5e1781
sys: derive Clone and Debug for mount_info::Entry and MountInfo
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-14 15:18:09 +01:00
Wolfgang Bumiller
bd4a6c5b8b
sys: use a BTreeMap for MountInfo internally
...
Since the only reasonable access is by mount "id" and they
don't need to be consecutive (but they are numeric), use a
BTreeMap for MountInfo.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-14 15:15:52 +01:00
Wolfgang Bumiller
4e27ec9eb1
sys: export MountInfo in procfs
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-14 14:56:03 +01:00
Wolfgang Bumiller
775c96f934
sys: more helpers for MountInfo
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-14 14:54:51 +01:00
Wolfgang Bumiller
40da8098df
sys: add /proc/self/mountinfo parsing
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-14 14:41:21 +01:00
Wolfgang Bumiller
e128fc879f
sys: Add TryFrom<Pid> for PidStat
...
Since nix's Pid type is a strong type, we can add a TryFrom
implementation here as well.
This can later also have the equivalent TryFrom<PidFd>
variant.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-14 12:05:04 +01:00
Wolfgang Bumiller
42a155668e
sys: change PidStat API
...
Rather than standalone functions, `PidStat` now provides a
`read_for_pid` and `parse` method. Both are public.
One side effect is that the documentation of PidStat's
contents are on the same page as the ways to retrieve it.
Additionally, we deprecate `read_proc_starttime` as it was
reading the entire contents to then filter out one value, in
order to promote caching.
The standalone `read_proc_pid_stat` method is now also
deprecated.
Once we add pid-fds the API will feel cleaner this way.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-14 12:01:06 +01:00
Wolfgang Bumiller
e3b41dc815
sys: extend proc_pid_stat parsing
...
Rename `ProcFsPidStat` to `PidStat`. It's already in a
procfs submodule anyway. (We have currently no public users
of this type by name.)
Further add pid, ppid and num_threads to PidStat.
Public API change.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-14 11:49:33 +01:00
Wolfgang Bumiller
43682dd416
version bump
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-02 14:42:28 +01:00
Wolfgang Bumiller
b659584f23
sys: add a bunch of error helpers
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-02 13:47:53 +01:00
Wolfgang Bumiller
568ce10624
sys: add some helpful macros
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-02 13:47:53 +01:00
Wolfgang Bumiller
1a2aaad5a1
more versioning fixups
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-30 12:33:13 +01:00
Fabian Grünbichler
d6bf884814
proxmox-sys: initial packaging
...
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-12-20 09:39:45 +01:00
Fabian Grünbichler
f4d9e8157c
proxmox-sys: update lazy-static to 1.4
...
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-12-20 09:39:45 +01:00
Thomas Lamprecht
cfae8ae3d2
linux/procfs: add read_proc_stat
...
For now we just parse the CPU "time-spent" counters and calculate the
CPU usage of the whole system. As we do not want a total average we
use a state-full implementation, which calculates the usage since the
last request (if older than 1 second).
Somewhat modeled after our Perl version of this. But for the "total"
we do not use the:
> ($ctime - $last_proc_stat->{ctime}) * $clock_ticks * $cpucount;
calculation, but just add _all_ fields together, as that is the total
of CPU time.
Use a Reader-Writer lock to sync updating. First check under the
reader lock if the data is recent enough, else update it under the
writer lock.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-12-18 17:00:51 +01:00
Wolfgang Bumiller
6cf330c9d2
add tools::parse submodule, move hex_nibble to it
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-14 09:59:04 +01:00
Wolfgang Bumiller
db83a675f0
sys: get rid of Regex dependency
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-13 14:49:11 +01:00
Wolfgang Bumiller
b294fb1314
sys: add read_proc_pid_stat test
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-13 14:49:11 +01:00
Wolfgang Bumiller
a11f6e88f8
[clippy] sys: simplifications and optimizations
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-22 09:28:44 +02:00
Wolfgang Bumiller
45b5839e7e
replace std::mem::uninitialized
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-21 16:49:12 +02:00
Wolfgang Bumiller
aadb47a292
update nix to 0.15 for mkdirat
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-21 11:51:45 +02:00
Wolfgang Bumiller
ccce46eba4
formatting fixup
...
make fmt
(cargo fmt --all)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-05 14:14:23 +02:00
Wolfgang Bumiller
863a16a5bc
whitespace cleanup
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-05 14:13:37 +02:00
Wolfgang Bumiller
4c9a8b5c88
cleanup use statements
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-05 14:12:49 +02:00
Wolfgang Bumiller
f074a9e60b
cleanup Cargo.toml files
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-05 14:09:54 +02:00
Wolfgang Bumiller
1f11c4adf9
sys: rustfmt workaround
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-05 12:46:21 +02:00
Dietmar Maurer
d6d65be42e
add nodename helper (copied from proxmox-backup)
2019-08-03 17:00:02 +02:00
Dietmar Maurer
ce18d8c035
src/linux/procfs.rs: moved from proxmox-backup
2019-08-03 16:19:11 +02:00
Dietmar Maurer
909520d191
add src/linux/magic.rs - moved from proxmox-backup
2019-08-03 09:19:32 +02:00
Wolfgang Bumiller
024930f63c
cargo fmt --all
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-06-12 09:48:30 +02:00
Dietmar Maurer
71f2d48c2e
start proxmox-sys module
2019-06-07 18:03:07 +02:00