<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/tools/include/nolibc/sys.h, branch v6.4</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v6.4</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v6.4'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2023-03-20T15:45:22Z</updated>
<entry>
<title>tools/nolibc: Add statx() and make stat() rely on statx() if necessary</title>
<updated>2023-03-20T15:45:22Z</updated>
<author>
<name>Feiyang Chen</name>
<email>chenfeiyang@loongson.cn</email>
</author>
<published>2023-03-04T14:28:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b551cb7dc347d0d142f4b65b5fa0d052e09e559a'/>
<id>urn:sha1:b551cb7dc347d0d142f4b65b5fa0d052e09e559a</id>
<content type='text'>
LoongArch and RISC-V 32-bit only have statx(). ARC, Hexagon, Nios2 and
OpenRISC have statx() and stat64() but not stat() or newstat(). Add
statx() and make stat() rely on statx() if necessary to make them happy.
We may just use statx() for all architectures in the future.

Signed-off-by: Feiyang Chen &lt;chenfeiyang@loongson.cn&gt;
Acked-by: Huacai Chen &lt;chenhuacai@loongson.cn&gt;
Signed-off-by: Willy Tarreau &lt;w@1wt.eu&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
<entry>
<title>tools/nolibc: Include linux/fcntl.h and remove duplicate code</title>
<updated>2023-03-20T15:45:22Z</updated>
<author>
<name>Feiyang Chen</name>
<email>chenfeiyang@loongson.cn</email>
</author>
<published>2023-03-04T14:28:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a438e528b68fe81c10833538bd454e9f59d092a2'/>
<id>urn:sha1:a438e528b68fe81c10833538bd454e9f59d092a2</id>
<content type='text'>
Include linux/fcntl.h for O_* and AT_*. asm/fcntl.h is included
by linux/fcntl.h, so it can be safely removed.

Signed-off-by: Feiyang Chen &lt;chenfeiyang@loongson.cn&gt;
Acked-by: Huacai Chen &lt;chenhuacai@loongson.cn&gt;
Signed-off-by: Willy Tarreau &lt;w@1wt.eu&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
<entry>
<title>tools/nolibc: add getuid() and geteuid()</title>
<updated>2023-03-20T15:45:22Z</updated>
<author>
<name>Willy Tarreau</name>
<email>w@1wt.eu</email>
</author>
<published>2023-03-04T14:28:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=919d0532d48ca1bea62bc04f269b9e72706467c6'/>
<id>urn:sha1:919d0532d48ca1bea62bc04f269b9e72706467c6</id>
<content type='text'>
This can be useful to avoid attempting some privileged operations,
starting from the nolibc-test tool that gets two failures when not
privileged.

We call getuid32() and geteuid32() when they are defined, and fall
back to getuid() and geteuid() otherwise.

Signed-off-by: Willy Tarreau &lt;w@1wt.eu&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
<entry>
<title>nolibc/sys: Implement `getpagesize(2)` function</title>
<updated>2023-01-10T21:33:56Z</updated>
<author>
<name>Ammar Faizi</name>
<email>ammarfaizi2@gnuweeb.org</email>
</author>
<published>2023-01-10T07:24:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7efd762e97c87f07b0a93e428e5ce3436715f538'/>
<id>urn:sha1:7efd762e97c87f07b0a93e428e5ce3436715f538</id>
<content type='text'>
This function returns the page size used by the running kernel. The
page size value is taken from the auxiliary vector at 'AT_PAGESZ' key.

'getpagesize(2)' is assumed as a syscall becuase the manpage placement
of this function is in entry 2 ('man 2 getpagesize') despite there is
no real 'getpagesize(2)' syscall in the Linux syscall table. Define
this function in 'sys.h'.

Signed-off-by: Ammar Faizi &lt;ammarfaizi2@gnuweeb.org&gt;
Signed-off-by: Willy Tarreau &lt;w@1wt.eu&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
<entry>
<title>tools/nolibc: remove local definitions of O_* flags for open/fcntl</title>
<updated>2023-01-10T21:33:55Z</updated>
<author>
<name>Willy Tarreau</name>
<email>w@1wt.eu</email>
</author>
<published>2023-01-10T07:24:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d5b48f958b36e38ee1a9bebb522bdd86114c34ae'/>
<id>urn:sha1:d5b48f958b36e38ee1a9bebb522bdd86114c34ae</id>
<content type='text'>
The historic nolibc code did not include asm/fcntl.h and had to define
the various O_RDWR etc macros in each arch-specific file (since such
values differ between certain archs). This was found at least once to
induce bugs due to wrong definitions. Let's get rid of all of them and
include asm/nolibc.h from sys.h instead. This was verified to work
properly on all supported architectures.

Signed-off-by: Willy Tarreau &lt;w@1wt.eu&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
<entry>
<title>nolibc: add support for s390</title>
<updated>2023-01-09T17:36:05Z</updated>
<author>
<name>Sven Schnelle</name>
<email>svens@linux.ibm.com</email>
</author>
<published>2023-01-09T08:09:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=18a5a09d90a75f40d5dcd3bd2ff9052845f36c37'/>
<id>urn:sha1:18a5a09d90a75f40d5dcd3bd2ff9052845f36c37</id>
<content type='text'>
Use arch-x86_64 as a template. Not really different, but
we have our own mmap syscall which takes a structure instead
of discrete arguments.

Signed-off-by: Sven Schnelle &lt;svens@linux.ibm.com&gt;
Acked-by: Heiko Carstens &lt;hca@linux.ibm.com&gt;
Signed-off-by: Willy Tarreau &lt;w@1wt.eu&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
<entry>
<title>tools/nolibc: fix missing includes causing build issues at -O0</title>
<updated>2023-01-09T17:36:05Z</updated>
<author>
<name>Willy Tarreau</name>
<email>w@1wt.eu</email>
</author>
<published>2023-01-09T07:54:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=55abdd1f5e1e07418bf4a46c233a92f83cb5ae97'/>
<id>urn:sha1:55abdd1f5e1e07418bf4a46c233a92f83cb5ae97</id>
<content type='text'>
After the nolibc includes were split to facilitate portability from
standard libcs, programs that include only what they need may miss
some symbols which are needed by libgcc. This is the case for raise()
which is needed by the divide by zero code in some architectures for
example.

Regardless, being able to include only the apparently needed files is
convenient.

Instead of trying to move all exported definitions to a single file,
since this can change over time, this patch takes another approach
consisting in including the nolibc header at the end of all standard
include files. This way their types and functions are already known
at the moment of inclusion, and including any single one of them is
sufficient to bring all the required ones.

Signed-off-by: Willy Tarreau &lt;w@1wt.eu&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
<entry>
<title>tools/nolibc: make sys_mmap() automatically use the right __NR_mmap definition</title>
<updated>2022-08-31T12:17:43Z</updated>
<author>
<name>Willy Tarreau</name>
<email>w@1wt.eu</email>
</author>
<published>2022-07-19T21:44:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=364702f7551451f2fab341f1b31adf911c888375'/>
<id>urn:sha1:364702f7551451f2fab341f1b31adf911c888375</id>
<content type='text'>
__NR_mmap2 was used for i386 but it's also needed for other archs such
as RISCV32 or ARM. Let's decide to use it based on the __NR_mmap2
definition as it's not defined on other archs.

Signed-off-by: Willy Tarreau &lt;w@1wt.eu&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
<entry>
<title>tools/nolibc: fix build warning in sys_mmap() when my_syscall6 is not defined</title>
<updated>2022-08-31T12:17:43Z</updated>
<author>
<name>Willy Tarreau</name>
<email>w@1wt.eu</email>
</author>
<published>2022-07-19T21:44:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8b53e83b08cfdc3f430b5415cd1031d5e7e1f935'/>
<id>urn:sha1:8b53e83b08cfdc3f430b5415cd1031d5e7e1f935</id>
<content type='text'>
We return -ENOSYS when there's no syscall6() operation, but we must cast
it to void* to avoid a warning.

Signed-off-by: Willy Tarreau &lt;w@1wt.eu&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
<entry>
<title>tools/nolibc/sys: Implement `mmap()` and `munmap()`</title>
<updated>2022-04-21T00:05:46Z</updated>
<author>
<name>Ammar Faizi</name>
<email>ammarfaizi2@gnuweeb.org</email>
</author>
<published>2022-03-29T10:17:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=544fa1a2d3e61c954ab531f2c790bc79c1745606'/>
<id>urn:sha1:544fa1a2d3e61c954ab531f2c790bc79c1745606</id>
<content type='text'>
Implement mmap() and munmap(). Currently, they are only available for
architecures that have my_syscall6 macro. For architectures that don't
have, this function will return -1 with errno set to ENOSYS (Function
not implemented).

This has been tested on x86 and i386.

Notes for i386:
 1) The common mmap() syscall implementation uses __NR_mmap2 instead
    of __NR_mmap.

 2) The offset must be shifted-right by 12-bit.

Acked-by: Willy Tarreau &lt;w@1wt.eu&gt;
Signed-off-by: Ammar Faizi &lt;ammarfaizi2@gnuweeb.org&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
</feed>
