Skip to content

Commit 2832d0c

Browse files
committed
Add basic versioning scheme
QUARK_VERSION should be shared by libquark, quark-btf, quark-mon and also elastic/go-quark. A release has the form "MAJOR.MINOR", we break ABI *freely*, so a MINOR can break ABI. MAJOR denotes a major milestone, or some cool stuff that was added. Quark is not meant to be distributed as a shared object, therefore it makes no sense for us to be careful with ABI breakages, users should be building quark together with their application. We should document them in a CHANGES file for every release. The suffix "a" is added to the version we are working on, so when we're about to release: remove the suffix; release; bump with suffix.
1 parent 5e998b8 commit 2832d0c

7 files changed

+59
-4
lines changed

docs/quark-btf.8.html

+10-1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ <h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a><
4545
<var class="Ar">btf_file name version</var></td>
4646
</tr>
4747
</table>
48+
<br/>
49+
<table class="Nm">
50+
<tr>
51+
<td><code class="Nm">quark-btf <code class="Fl">-V</code></code></td>
52+
<td></td>
53+
</tr>
54+
</table>
4855
</section>
4956
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
5057
The <code class="Nm">quark-btf</code> program prints out the kernel structures
@@ -86,6 +93,8 @@ <h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIP
8693
<dd>Increase
8794
<a class="permalink" href="#quark_verbose"><i class="Em" id="quark_verbose">quark_verbose</i></a>,
8895
can be issued multiple times.</dd>
96+
<dt id="V"><a class="permalink" href="#V"><code class="Fl">-V</code></a></dt>
97+
<dd>Print version and exit.</dd>
8998
</dl>
9099
<section class="Sh">
91100
<h1 class="Sh" id="EXIT_STATUS"><a class="permalink" href="#EXIT_STATUS">EXIT
@@ -146,7 +155,7 @@ <h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
146155
</div>
147156
<table class="foot">
148157
<tr>
149-
<td class="foot-date">October 4, 2024</td>
158+
<td class="foot-date">October 14, 2024</td>
150159
<td class="foot-os">Linux</td>
151160
</tr>
152161
</table>

docs/quark-mon.8.html

+10-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ <h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a><
3131
<var class="Ar">maxnodes</var>]</td>
3232
</tr>
3333
</table>
34+
<br/>
35+
<table class="Nm">
36+
<tr>
37+
<td><code class="Nm">quark-mon <code class="Fl">-V</code></code></td>
38+
<td></td>
39+
</tr>
40+
</table>
3441
</section>
3542
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
3643
The <code class="Nm">quark-mon</code> program listens to all incoming
@@ -95,6 +102,8 @@ <h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIP
95102
sorted by time, and the second by pid plus time. Exits after
96103
<var class="Ar">maxnodes</var> has been reached. This is used purely for
97104
internal debugging.</dd>
105+
<dt id="V"><a class="permalink" href="#V"><code class="Fl">-V</code></a></dt>
106+
<dd>Print version and exit.</dd>
98107
</dl>
99108
<section class="Sh">
100109
<h1 class="Sh" id="BACKEND_SELECTION"><a class="permalink" href="#BACKEND_SELECTION">BACKEND
@@ -161,7 +170,7 @@ <h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
161170
</div>
162171
<table class="foot">
163172
<tr>
164-
<td class="foot-date">September 19, 2024</td>
173+
<td class="foot-date">October 14, 2024</td>
165174
<td class="foot-os">Linux</td>
166175
</tr>
167176
</table>

quark-btf.8

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
.Nm quark-btf
1717
.Op Fl v
1818
.Fl g Ar btf_file name version
19+
.Nm quark-btf Fl V
1920
.Sh DESCRIPTION
2021
The
2122
.Nm
@@ -58,6 +59,8 @@ Matching can be partial.
5859
Increase
5960
.Em quark_verbose ,
6061
can be issued multiple times.
62+
.It Fl V
63+
Print version and exit.
6164
.El
6265
.Sh EXIT STATUS
6366
.Nm

quark-btf.c

+15-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ static int fflag;
1616
static int gflag;
1717
static int lflag;
1818

19+
static void
20+
disply_version(void)
21+
{
22+
printf("%s-%s\n", program_invocation_short_name, QUARK_VERSION);
23+
printf("License: Apache-2.0\n");
24+
printf("Copyright (c) 2024 Elastic NV\n");
25+
26+
exit(0);
27+
}
28+
1929
static void
2030
usage(void)
2131
{
@@ -27,6 +37,7 @@ usage(void)
2737
program_invocation_short_name);
2838
fprintf(stderr, "usage: %s [-v] [-g btf_file name version]\n",
2939
program_invocation_short_name);
40+
fprintf(stderr, "usage: %s -V\n", program_invocation_short_name);
3041

3142
exit(1);
3243
}
@@ -218,7 +229,7 @@ main(int argc, char *argv[])
218229
int ch;
219230
const char *path = NULL;
220231

221-
while ((ch = getopt(argc, argv, "bf:glv")) != -1) {
232+
while ((ch = getopt(argc, argv, "bf:glvV")) != -1) {
222233
switch (ch) {
223234
case 'b':
224235
bflag = 1;
@@ -238,6 +249,9 @@ main(int argc, char *argv[])
238249
case 'v':
239250
quark_verbose++;
240251
break;
252+
case 'V':
253+
disply_version();
254+
break;
241255
default:
242256
usage();
243257
}

quark-mon.8

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
.Op Fl C Ar filename
1111
.Op Fl l Ar maxlength
1212
.Op Fl m Ar maxnodes
13+
.Nm quark-mon Fl V
1314
.Sh DESCRIPTION
1415
The
1516
.Nm
@@ -82,6 +83,8 @@ Exits after
8283
.Ar maxnodes
8384
has been reached.
8485
This is used purely for internal debugging.
86+
.It Fl V
87+
Print version and exit.
8588
.El
8689
.Sh BACKEND SELECTION
8790
If no backend option is specified,

quark-mon.c

+15-1
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,23 @@ priv_drop(void)
5858
err(1, "error dropping privileges");
5959
}
6060

61+
static void
62+
display_version(void)
63+
{
64+
printf("%s-%s\n", program_invocation_short_name, QUARK_VERSION);
65+
printf("License: Apache-2.0\n");
66+
printf("Copyright (c) 2024 Elastic NV\n");
67+
68+
exit(0);
69+
}
70+
6171
static void
6272
usage(void)
6373
{
6474
fprintf(stderr, "usage: %s [-bDefkstv] "
6575
"[-C filename ] [-l maxlength] [-m maxnodes]\n",
6676
program_invocation_short_name);
77+
fprintf(stderr, "usage: %s -V\n", program_invocation_short_name);
6778

6879
exit(1);
6980
}
@@ -86,7 +97,7 @@ main(int argc, char *argv[])
8697
nqevs = 32;
8798
graph_by_time = graph_by_pidtime = graph_cache = NULL;
8899

89-
while ((ch = getopt(argc, argv, "bC:Degklm:tsv")) != -1) {
100+
while ((ch = getopt(argc, argv, "bC:Degklm:tsvV")) != -1) {
90101
const char *errstr;
91102

92103
switch (ch) {
@@ -141,6 +152,9 @@ main(int argc, char *argv[])
141152
case 'v':
142153
quark_verbose++;
143154
break;
155+
case 'V':
156+
display_version();
157+
break;
144158
default:
145159
usage();
146160
}

quark.h

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
#ifndef _QUARK_H_
55
#define _QUARK_H_
66

7+
/* Version is shared between library and utilities */
8+
#define QUARK_VERSION "0.1a"
9+
710
/* Misc types */
811
#include <stdio.h>
912

0 commit comments

Comments
 (0)