ioprio 1.0.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -0
- data/README.md +19 -9
- data/ext/ioprio/ioprio.c +41 -0
- data/lib/ioprio/core_ext/process.rb +18 -0
- data/lib/ioprio/version.rb +1 -1
- metadata +7 -8
- data/sig/ioprio.rbs +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0fb831b17858f6ca4ccbc7a0ce801ea4ca1ad0e227b2e4b1dc73729f20a69da4
|
4
|
+
data.tar.gz: 700f86e79a88dccf15e6d563b196b74a2434103a3012f65da0985bb60e07a15a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20479189989d986a3f127be39474df243b334cc1ecdfc2a359776c34333aa19481c330a8f2878d13832eabab8252ee7a9d86b33ecb1623e1f5c4f60c3e326b3a
|
7
|
+
data.tar.gz: dcbe6e832bca278217b8751b51a4994269938d56e2ee1771d2054950fa960d23eb652decf1b3280c2c6d2b8dbd953b749b8116066d20eaf3196bb11ec8f228c6
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,23 @@
|
|
1
|
+
## [1.1.1](https://github.com/benmelz/ioprio/compare/v1.1.0...v1.1.1) (2025-04-08)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* link to homepage and other pages correctly ([#11](https://github.com/benmelz/ioprio/issues/11)) ([91029c5](https://github.com/benmelz/ioprio/commit/91029c5ef52b9bf4e425c2bf1899124660a379db))
|
7
|
+
|
8
|
+
# [1.1.0](https://github.com/benmelz/ioprio/compare/v1.0.0...v1.1.0) (2025-04-02)
|
9
|
+
|
10
|
+
|
11
|
+
### Bug Fixes
|
12
|
+
|
13
|
+
* add constant stubs for better ide completions ([#6](https://github.com/benmelz/ioprio/issues/6)) ([9a6b98f](https://github.com/benmelz/ioprio/commit/9a6b98fea28b21c4e61583f3cad63a7870d6ac47))
|
14
|
+
|
15
|
+
|
16
|
+
### Features
|
17
|
+
|
18
|
+
* class constants ([#7](https://github.com/benmelz/ioprio/issues/7)) ([4a12db1](https://github.com/benmelz/ioprio/commit/4a12db1f06b66b1992d8e31f254ffbbb6c1735b9))
|
19
|
+
* masking macros ([#8](https://github.com/benmelz/ioprio/issues/8)) ([791db3b](https://github.com/benmelz/ioprio/commit/791db3b7f5187375c8f78a04f6e8390685c9cbbd))
|
20
|
+
|
1
21
|
# 1.0.0 (2025-04-02)
|
2
22
|
|
3
23
|
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# ioprio
|
2
2
|
|
3
|
-
|
3
|
+
A simple ruby API for the linux ioprio system.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -18,26 +18,36 @@ gem install ioprio
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
The ioprio syscalls are only supported by linux systems
|
21
|
+
The ioprio syscalls are only supported by linux systems. As such their wrappers (`ioprio_get`/`ioprio_set`) will only be implemented when built and run on a linux system.
|
22
22
|
|
23
|
-
All
|
23
|
+
All features either directly call or are a recreation of native ioprio system features. Refer to the linux man pages for usage instructions.
|
24
24
|
|
25
|
-
|
25
|
+
In ruby, the following constants and methods are defined on the `Process` module, corresponding to their native macros and syscalls:
|
26
26
|
|
27
27
|
```ruby
|
28
|
+
Process::IOPRIO_CLASS_NONE
|
29
|
+
Process::IOPRIO_CLASS_RT
|
30
|
+
Process::IOPRIO_CLASS_BE
|
31
|
+
Process::IOPRIO_CLASS_IDLE
|
32
|
+
|
28
33
|
Process::IOPRIO_WHO_PROCESS
|
29
34
|
Process::IOPRIO_WHO_PGRP
|
30
35
|
Process::IOPRIO_WHO_USER
|
31
36
|
|
32
|
-
Process.
|
33
|
-
Process.
|
37
|
+
Process.ioprio_prio_class(priority)
|
38
|
+
Process.ioprio_prio_data(priority)
|
39
|
+
Process.ioprio_prio_value(klass, data)
|
40
|
+
|
41
|
+
Process.ioprio_get(which, who)
|
42
|
+
Process.ioprio_set(which, who, priority)
|
34
43
|
```
|
35
44
|
|
36
45
|
## Development
|
37
46
|
|
38
|
-
|
39
|
-
|
40
|
-
|
47
|
+
* Run `bin/setup` to install dependencies.
|
48
|
+
* Run `bin/rake spec` to run the tests.
|
49
|
+
* Run `bin/rake rubocop` to run the linter.
|
50
|
+
* Run `bin/console` for an interactive prompt that will allow you to experiment.
|
41
51
|
|
42
52
|
## Contributing
|
43
53
|
|
data/ext/ioprio/ioprio.c
CHANGED
@@ -4,6 +4,14 @@
|
|
4
4
|
#include <sys/syscall.h>
|
5
5
|
#include <unistd.h>
|
6
6
|
|
7
|
+
enum
|
8
|
+
{
|
9
|
+
IOPRIO_CLASS_NONE,
|
10
|
+
IOPRIO_CLASS_RT,
|
11
|
+
IOPRIO_CLASS_BE,
|
12
|
+
IOPRIO_CLASS_IDLE,
|
13
|
+
};
|
14
|
+
|
7
15
|
enum
|
8
16
|
{
|
9
17
|
IOPRIO_WHO_PROCESS = 1,
|
@@ -11,6 +19,24 @@ enum
|
|
11
19
|
IOPRIO_WHO_USER,
|
12
20
|
};
|
13
21
|
|
22
|
+
static VALUE
|
23
|
+
ioprio_prio_class (VALUE obj, VALUE priority)
|
24
|
+
{
|
25
|
+
return INT2NUM (NUM2INT (priority) >> 13);
|
26
|
+
}
|
27
|
+
|
28
|
+
static VALUE
|
29
|
+
ioprio_prio_data (VALUE obj, VALUE priority)
|
30
|
+
{
|
31
|
+
return INT2NUM (NUM2INT (priority) & ((1UL << 13) - 1));
|
32
|
+
}
|
33
|
+
|
34
|
+
static VALUE
|
35
|
+
ioprio_prio_value (VALUE obj, VALUE class, VALUE data)
|
36
|
+
{
|
37
|
+
return INT2NUM ((NUM2INT (class) << 13) | NUM2INT (data));
|
38
|
+
}
|
39
|
+
|
14
40
|
#ifdef SYS_ioprio_get
|
15
41
|
static VALUE
|
16
42
|
ioprio_get (VALUE obj, VALUE which, VALUE who)
|
@@ -50,6 +76,15 @@ Init_ioprio (void)
|
|
50
76
|
VALUE rb_mod_ioprio_core_ext_process_class_methods = rb_define_module_under (
|
51
77
|
rb_mod_ioprio_core_ext_process, "ClassMethods");
|
52
78
|
|
79
|
+
rb_define_const (rb_mod_ioprio_core_ext_process, "IOPRIO_CLASS_NONE",
|
80
|
+
INT2NUM (IOPRIO_CLASS_NONE));
|
81
|
+
rb_define_const (rb_mod_ioprio_core_ext_process, "IOPRIO_CLASS_RT",
|
82
|
+
INT2NUM (IOPRIO_CLASS_RT));
|
83
|
+
rb_define_const (rb_mod_ioprio_core_ext_process, "IOPRIO_CLASS_BE",
|
84
|
+
INT2NUM (IOPRIO_CLASS_BE));
|
85
|
+
rb_define_const (rb_mod_ioprio_core_ext_process, "IOPRIO_CLASS_IDLE",
|
86
|
+
INT2NUM (IOPRIO_CLASS_IDLE));
|
87
|
+
|
53
88
|
rb_define_const (rb_mod_ioprio_core_ext_process, "IOPRIO_WHO_PROCESS",
|
54
89
|
INT2NUM (IOPRIO_WHO_PROCESS));
|
55
90
|
rb_define_const (rb_mod_ioprio_core_ext_process, "IOPRIO_WHO_PGRP",
|
@@ -57,6 +92,12 @@ Init_ioprio (void)
|
|
57
92
|
rb_define_const (rb_mod_ioprio_core_ext_process, "IOPRIO_WHO_USER",
|
58
93
|
INT2NUM (IOPRIO_WHO_USER));
|
59
94
|
|
95
|
+
rb_define_method (rb_mod_ioprio_core_ext_process_class_methods, "ioprio_prio_class",
|
96
|
+
ioprio_prio_class, 1);
|
97
|
+
rb_define_method (rb_mod_ioprio_core_ext_process_class_methods, "ioprio_prio_data",
|
98
|
+
ioprio_prio_data, 1);
|
99
|
+
rb_define_method (rb_mod_ioprio_core_ext_process_class_methods, "ioprio_prio_value",
|
100
|
+
ioprio_prio_value, 2);
|
60
101
|
rb_define_method (rb_mod_ioprio_core_ext_process_class_methods, "ioprio_get",
|
61
102
|
ioprio_get, 2);
|
62
103
|
rb_define_method (rb_mod_ioprio_core_ext_process_class_methods, "ioprio_set",
|
@@ -3,11 +3,29 @@
|
|
3
3
|
module Ioprio
|
4
4
|
module CoreExt
|
5
5
|
module Process
|
6
|
+
# actual values are initialized in C extension
|
7
|
+
# rubocop:disable Lint/LiteralAsCondition
|
8
|
+
IOPRIO_CLASS_NONE = _ if false
|
9
|
+
IOPRIO_CLASS_RT = _ if false
|
10
|
+
IOPRIO_CLASS_BE = _ if false
|
11
|
+
IOPRIO_CLASS_IDLE = _ if false
|
12
|
+
|
13
|
+
IOPRIO_WHO_PROCESS = _ if false
|
14
|
+
IOPRIO_WHO_PGRP = _ if false
|
15
|
+
IOPRIO_WHO_USER = _ if false
|
16
|
+
# rubocop:enable Lint/LiteralAsCondition
|
17
|
+
|
6
18
|
def self.included(klass)
|
7
19
|
klass.extend ClassMethods
|
8
20
|
end
|
9
21
|
|
10
22
|
module ClassMethods
|
23
|
+
def ioprio_prio_class(priority); end
|
24
|
+
|
25
|
+
def ioprio_prio_data(priority); end
|
26
|
+
|
27
|
+
def ioprio_prio_value(klass, data); end
|
28
|
+
|
11
29
|
def ioprio_get(which, who); end
|
12
30
|
|
13
31
|
def ioprio_set(which, who, priority); end
|
data/lib/ioprio/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ioprio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- benmelz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-04-
|
11
|
+
date: 2025-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -28,14 +28,13 @@ files:
|
|
28
28
|
- lib/ioprio/core_ext.rb
|
29
29
|
- lib/ioprio/core_ext/process.rb
|
30
30
|
- lib/ioprio/version.rb
|
31
|
-
|
32
|
-
homepage: https://github.com/benmelz/io_priority
|
31
|
+
homepage: https://github.com/benmelz/ioprio
|
33
32
|
licenses:
|
34
33
|
- MIT
|
35
34
|
metadata:
|
36
|
-
homepage_uri: https://github.com/benmelz/
|
37
|
-
source_code_uri: https://github.com/benmelz/
|
38
|
-
changelog_uri: https://github.com/benmelz/
|
35
|
+
homepage_uri: https://github.com/benmelz/ioprio
|
36
|
+
source_code_uri: https://github.com/benmelz/ioprio
|
37
|
+
changelog_uri: https://github.com/benmelz/ioprio/blob/v1.1.1/CHANGELOG.md
|
39
38
|
rubygems_mfa_required: 'true'
|
40
39
|
post_install_message:
|
41
40
|
rdoc_options: []
|
@@ -55,5 +54,5 @@ requirements: []
|
|
55
54
|
rubygems_version: 3.4.19
|
56
55
|
signing_key:
|
57
56
|
specification_version: 4
|
58
|
-
summary:
|
57
|
+
summary: A simple ruby API for the linux ioprio system.
|
59
58
|
test_files: []
|
data/sig/ioprio.rbs
DELETED