<feed xmlns='http://www.w3.org/2005/Atom'>
<title>unit.git/auto, branch compr</title>
<subtitle>Universal Web Application Server</subtitle>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/'/>
<entry>
<title>http: Wire up HTTP compression to the build system</title>
<updated>2024-11-29T00:45:24+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@nginx.com</email>
</author>
<published>2024-11-20T16:47:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=7a043c0a5e110fb6b8e9e22c958d8bb483101067'/>
<id>7a043c0a5e110fb6b8e9e22c958d8bb483101067</id>
<content type='text'>
This allows to actually build unit with support fro zlib, zstd and
brotli compression.

Any or all can be specified. E.g.

  $ ./configure --zlib ...

  $ ./configure --zlib --zstd --brotli ...

During configure you will see if support for the requested compressions
has been found and what version of the library is being used.

E.g.

  ...
  checking for zlib ... found
   + zlib version: 1.3.1.zlib-ng
  checking for zstd ... found
   + zstd version: 1.5.6
  checking for brotli ... found
   + brotli version: 1.1.0
  ...
  Unit configuration summary:
  ...
    zlib support: .............. YES
    zstd support: .............. YES
    brotli support: ............ YES
  ...

Co-authored-by: Alejandro Colomar &lt;alx@kernel.org&gt;
Signed-off-by: Alejandro Colomar &lt;alx@kernel.org&gt;
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This allows to actually build unit with support fro zlib, zstd and
brotli compression.

Any or all can be specified. E.g.

  $ ./configure --zlib ...

  $ ./configure --zlib --zstd --brotli ...

During configure you will see if support for the requested compressions
has been found and what version of the library is being used.

E.g.

  ...
  checking for zlib ... found
   + zlib version: 1.3.1.zlib-ng
  checking for zstd ... found
   + zstd version: 1.5.6
  checking for brotli ... found
   + brotli version: 1.1.0
  ...
  Unit configuration summary:
  ...
    zlib support: .............. YES
    zstd support: .............. YES
    brotli support: ............ YES
  ...

Co-authored-by: Alejandro Colomar &lt;alx@kernel.org&gt;
Signed-off-by: Alejandro Colomar &lt;alx@kernel.org&gt;
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>otel: add build tooling to include otel code</title>
<updated>2024-11-12T17:50:02+00:00</updated>
<author>
<name>Ava Hahn</name>
<email>a.hahn@f5.com</email>
</author>
<published>2024-11-07T22:14:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=9d3dcb800aba0c036b032ccd00197712c3f5d0d9'/>
<id>9d3dcb800aba0c036b032ccd00197712c3f5d0d9</id>
<content type='text'>
Adds the --otel flag to the configure command and the various build time
variables and checks that are needed in this flow.

It also includes the nxt_otel.c and nxt_otel.h files that are needed for
the rest of Unit to talk to the compiled static library that's generated
from the rust crate.

Signed-off-by: Ava Hahn &lt;a.hahn@f5.com&gt;
Co-authored-by: Gabor Javorszky &lt;g.javorszky@f5.com&gt;
Signed-off-by: Gabor Javorszky &lt;g.javorszky@f5.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Adds the --otel flag to the configure command and the various build time
variables and checks that are needed in this flow.

It also includes the nxt_otel.c and nxt_otel.h files that are needed for
the rest of Unit to talk to the compiled static library that's generated
from the rust crate.

Signed-off-by: Ava Hahn &lt;a.hahn@f5.com&gt;
Co-authored-by: Gabor Javorszky &lt;g.javorszky@f5.com&gt;
Signed-off-by: Gabor Javorszky &lt;g.javorszky@f5.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>java: Update third-party components to their recent versions</title>
<updated>2024-11-12T01:05:37+00:00</updated>
<author>
<name>Sergey A. Osokin</name>
<email>osa@FreeBSD.org.ru</email>
</author>
<published>2024-11-09T17:34:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=0391a3ca68017fbc0d862b2d6000e3fd8980e71e'/>
<id>0391a3ca68017fbc0d862b2d6000e3fd8980e71e</id>
<content type='text'>
[ Tweaked subject - Andrew ]
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Tweaked subject - Andrew ]
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>auto: Remove unused pthread spinlock checks</title>
<updated>2024-11-05T21:04:50+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@nginx.com</email>
</author>
<published>2024-11-05T21:04:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=158322ec9b7d2591c33102079c72e9720421f512'/>
<id>158322ec9b7d2591c33102079c72e9720421f512</id>
<content type='text'>
When configuring under Linux we always got the following

  checking for pthread spinlock zero initial value ... found but is not working

Having *actually* taken a look at this, this check seems somewhat bogus,
the first thing it does is

  pthread_spinlock_t  lock = 0;

which you shouldn't do anyway, you should use pthread_spin_init(3) to
initialise the pthread_spinlock_t variable.

But in any case, this thing, NXT_HAVE_PTHREAD_SPINLOCK_ZERO, isn't even
checked for in the code.

Neither is NXT_HAVE_PTHREAD_SPINLOCK, we don't use the pthread_spin_*
API, but rather roll our own spinlock implementation.

So let's just remove these checks, at the very least it'll speed
./configure up!

Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When configuring under Linux we always got the following

  checking for pthread spinlock zero initial value ... found but is not working

Having *actually* taken a look at this, this check seems somewhat bogus,
the first thing it does is

  pthread_spinlock_t  lock = 0;

which you shouldn't do anyway, you should use pthread_spin_init(3) to
initialise the pthread_spinlock_t variable.

But in any case, this thing, NXT_HAVE_PTHREAD_SPINLOCK_ZERO, isn't even
checked for in the code.

Neither is NXT_HAVE_PTHREAD_SPINLOCK, we don't use the pthread_spin_*
API, but rather roll our own spinlock implementation.

So let's just remove these checks, at the very least it'll speed
./configure up!

Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Compile with -funsigned-char</title>
<updated>2024-09-24T14:57:16+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@nginx.com</email>
</author>
<published>2022-11-10T19:54:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=355f038fdea54bb62fab942729b9386591d308b2'/>
<id>355f038fdea54bb62fab942729b9386591d308b2</id>
<content type='text'>
Due to 'char' (unless explicitly set) being signed or unsigned depending
on architecture, e.g on x86 it's signed, while on Arm it's unsigned,
this can lead to subtle bugs such if you use a plain char as a byte
thinking it's unsigned on all platforms (maybe you live in the world of
Arm).

What we can do is tell the compiler to treat 'char' as unsigned by
default, thus it will be consistent across platforms. Seeing as most of
the time it doesn't matter whether char is signed or unsigned, it
really only matters when you're dealing with 'bytes', which means it
makes sense to default char to unsigned.

The Linux Kernel made this change at the end of 2022.

This will also allow in the future to convert our u_char's to char's
(which will now be unsigned) and pass them directly into the libc
functions for example, without the need for casting.

Here is what the ISO C standard has to say

From §6.2.5 Types ¶15

  The three types char, signed char, and unsigned char are collectively
  called the character types. The implementation shall define char to
  have the same range, representation, and behavior as either signed
  char or unsigned char.[45]

and from Footnote 45)

  CHAR_MIN, defined in &lt;limits.h&gt;, will have one of the values 0 or
  SCHAR_MIN, and this can be used to distinguish the two options.
  Irrespective of the choice made, char is a separate type from the
  other two and is not compatible with either.

If you're still unsure why you'd want this change...

It was never clear to me, why we used u_char, perhaps that was used as
an alternative to -funsigned-char...

But that still leaves the potential for bugs with char being unsigned vs
signed...

Then because we use u_char but often need to pass such things into libc
(and perhaps other functions) which normally take a 'char' we need to
cast these cases.

So this change brings at least two (or more) benefits

  1) Removal of potential for char unsigned vs signed bugs.

  2) Removal of a bunch of casts. Reducing casting to the bare minimum
     is good. This helps the compiler to do proper type checking.

  3) Readability/maintainability, everything is now just char...

What if you want to work with bytes?

Well with char being unsigned (everywhere) you can of course use char.

However it would be much better to use the uint8_t type for that to
clearly signify that intention.

Link: &lt;https://lore.kernel.org/lkml/Y1Bfg06qV0sDiugt@zx2c4.com/&gt;
Link: &lt;https://lore.kernel.org/lkml/20221019203034.3795710-1-Jason@zx2c4.com/&gt;
Link: &lt;https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3bc753c06dd02a3517c9b498e3846ebfc94ac3ee&gt;
Link: &lt;https://www.iso-9899.info/n1570.html#6.2.5p15&gt;
Suggested-by: Alejandro Colomar &lt;alx@kernel.org&gt;
Reviewed-by: Alejandro Colomar &lt;alx@kernel.org&gt;
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Due to 'char' (unless explicitly set) being signed or unsigned depending
on architecture, e.g on x86 it's signed, while on Arm it's unsigned,
this can lead to subtle bugs such if you use a plain char as a byte
thinking it's unsigned on all platforms (maybe you live in the world of
Arm).

What we can do is tell the compiler to treat 'char' as unsigned by
default, thus it will be consistent across platforms. Seeing as most of
the time it doesn't matter whether char is signed or unsigned, it
really only matters when you're dealing with 'bytes', which means it
makes sense to default char to unsigned.

The Linux Kernel made this change at the end of 2022.

This will also allow in the future to convert our u_char's to char's
(which will now be unsigned) and pass them directly into the libc
functions for example, without the need for casting.

Here is what the ISO C standard has to say

From §6.2.5 Types ¶15

  The three types char, signed char, and unsigned char are collectively
  called the character types. The implementation shall define char to
  have the same range, representation, and behavior as either signed
  char or unsigned char.[45]

and from Footnote 45)

  CHAR_MIN, defined in &lt;limits.h&gt;, will have one of the values 0 or
  SCHAR_MIN, and this can be used to distinguish the two options.
  Irrespective of the choice made, char is a separate type from the
  other two and is not compatible with either.

If you're still unsure why you'd want this change...

It was never clear to me, why we used u_char, perhaps that was used as
an alternative to -funsigned-char...

But that still leaves the potential for bugs with char being unsigned vs
signed...

Then because we use u_char but often need to pass such things into libc
(and perhaps other functions) which normally take a 'char' we need to
cast these cases.

So this change brings at least two (or more) benefits

  1) Removal of potential for char unsigned vs signed bugs.

  2) Removal of a bunch of casts. Reducing casting to the bare minimum
     is good. This helps the compiler to do proper type checking.

  3) Readability/maintainability, everything is now just char...

What if you want to work with bytes?

Well with char being unsigned (everywhere) you can of course use char.

However it would be much better to use the uint8_t type for that to
clearly signify that intention.

Link: &lt;https://lore.kernel.org/lkml/Y1Bfg06qV0sDiugt@zx2c4.com/&gt;
Link: &lt;https://lore.kernel.org/lkml/20221019203034.3795710-1-Jason@zx2c4.com/&gt;
Link: &lt;https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3bc753c06dd02a3517c9b498e3846ebfc94ac3ee&gt;
Link: &lt;https://www.iso-9899.info/n1570.html#6.2.5p15&gt;
Suggested-by: Alejandro Colomar &lt;alx@kernel.org&gt;
Reviewed-by: Alejandro Colomar &lt;alx@kernel.org&gt;
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>java: Update third-party components</title>
<updated>2024-09-07T17:21:35+00:00</updated>
<author>
<name>Sergey A. Osokin</name>
<email>osa@FreeBSD.org.ru</email>
</author>
<published>2024-09-07T15:43:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=27d3a5c7c0d9b9fc03b69871aea6b3c9ab16aaa0'/>
<id>27d3a5c7c0d9b9fc03b69871aea6b3c9ab16aaa0</id>
<content type='text'>
[ Tweaked subject - Andrew ]
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Tweaked subject - Andrew ]
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>auto: Add a check for Linux's sched_getaffinity(2)</title>
<updated>2024-08-19T22:29:40+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@nginx.com</email>
</author>
<published>2024-08-11T15:46:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=f38201c2a144fb28978eabb32a3a080874f92775'/>
<id>f38201c2a144fb28978eabb32a3a080874f92775</id>
<content type='text'>
This will help to better determine the number of router threads to
create in certain situations.

Unlike sysconf(_SC_NPROCESSORS_ONLN) this takes into account per-process
cpu allowed masks as set by sched_setaffinity(2)/cpusets etc.

So while a system may have 64 on-line cpu's, Unit itself may be limited
to using just four of them in which case we should create four extra
router threads, not sixty-four!

Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This will help to better determine the number of router threads to
create in certain situations.

Unlike sysconf(_SC_NPROCESSORS_ONLN) this takes into account per-process
cpu allowed masks as set by sched_setaffinity(2)/cpusets etc.

So while a system may have 64 on-line cpu's, Unit itself may be limited
to using just four of them in which case we should create four extra
router threads, not sixty-four!

Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>auto, wasm-wc: Copy the .so into build/lib/unit/modules/</title>
<updated>2024-07-08T14:43:17+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@nginx.com</email>
</author>
<published>2024-07-02T16:02:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=b5fe3eaf1a0bcbc98d274902f5e38f2c2ad71dbc'/>
<id>b5fe3eaf1a0bcbc98d274902f5e38f2c2ad71dbc</id>
<content type='text'>
Normally when the language modules are built, they are built directly
into the build/lib/unit/modules/ directory.

This then allows Unit to find them without being installed. This is
useful for things like the pytests.

This wasn't happening for the wasm-wasi-component language module. So we
now copy it over and give it the right name as part of the make/build
process.

Reported-by: Andrei Zeliankou &lt;zelenkov@nginx.com&gt;
Fixes: 4e6d7e876 ("Wasm-wc: Wire it up to the build system")
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Normally when the language modules are built, they are built directly
into the build/lib/unit/modules/ directory.

This then allows Unit to find them without being installed. This is
useful for things like the pytests.

This wasn't happening for the wasm-wasi-component language module. So we
now copy it over and give it the right name as part of the make/build
process.

Reported-by: Andrei Zeliankou &lt;zelenkov@nginx.com&gt;
Fixes: 4e6d7e876 ("Wasm-wc: Wire it up to the build system")
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>auto: Fix some indentation in auto/modules/wasm-wasi-component</title>
<updated>2024-07-08T14:43:17+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@nginx.com</email>
</author>
<published>2024-07-02T16:01:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=0e6cc6dcfbd0c019bcd1b264252aeb88303b7362'/>
<id>0e6cc6dcfbd0c019bcd1b264252aeb88303b7362</id>
<content type='text'>
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Use octal instead of mode macros</title>
<updated>2024-06-18T20:59:45+00:00</updated>
<author>
<name>Alejandro Colomar</name>
<email>alx@kernel.org</email>
</author>
<published>2024-04-24T21:31:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=d96d583328f614c658d42f5bb0d2a0f81621327e'/>
<id>d96d583328f614c658d42f5bb0d2a0f81621327e</id>
<content type='text'>
They are more readable.

And we had a mix of both styles; there wasn't really a consistent style.

Tested-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
Reviewed-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
Signed-off-by: Alejandro Colomar &lt;alx@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
They are more readable.

And we had a mix of both styles; there wasn't really a consistent style.

Tested-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
Reviewed-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
Signed-off-by: Alejandro Colomar &lt;alx@kernel.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
