-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tools/nolibc/std: move the standard type definitions to std.h
[ Upstream commit 967cce1 ] The ordering of includes and definitions for now is a bit of a mess, as for example asm/signal.h is included after int definitions, but plenty of structures are defined later as they rely on other includes. Let's move the standard type definitions to a dedicated file that is included first. We also move NULL there. This way all other includes are aware of it, and we can bring asm/signal.h back to the top of the file. Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Paul E. McKenney <paulmck@kernel.org> Stable-dep-of: 184177c ("tools/nolibc: restore mips branch ordering in the _start block") Signed-off-by: Sasha Levin <sashal@kernel.org>
- Loading branch information
Showing
2 changed files
with
54 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* SPDX-License-Identifier: LGPL-2.1 OR MIT */ | ||
/* | ||
* Standard definitions and types for NOLIBC | ||
* Copyright (C) 2017-2021 Willy Tarreau <w@1wt.eu> | ||
*/ | ||
|
||
#ifndef _NOLIBC_STD_H | ||
#define _NOLIBC_STD_H | ||
|
||
/* Declare a few quite common macros and types that usually are in stdlib.h, | ||
* stdint.h, ctype.h, unistd.h and a few other common locations. Please place | ||
* integer type definitions and generic macros here, but avoid OS-specific and | ||
* syscall-specific stuff, as this file is expected to be included very early. | ||
*/ | ||
|
||
/* note: may already be defined */ | ||
#ifndef NULL | ||
#define NULL ((void *)0) | ||
#endif | ||
|
||
/* stdint types */ | ||
typedef unsigned char uint8_t; | ||
typedef signed char int8_t; | ||
typedef unsigned short uint16_t; | ||
typedef signed short int16_t; | ||
typedef unsigned int uint32_t; | ||
typedef signed int int32_t; | ||
typedef unsigned long long uint64_t; | ||
typedef signed long long int64_t; | ||
typedef unsigned long size_t; | ||
typedef signed long ssize_t; | ||
typedef unsigned long uintptr_t; | ||
typedef signed long intptr_t; | ||
typedef signed long ptrdiff_t; | ||
|
||
/* those are commonly provided by sys/types.h */ | ||
typedef unsigned int dev_t; | ||
typedef unsigned long ino_t; | ||
typedef unsigned int mode_t; | ||
typedef signed int pid_t; | ||
typedef unsigned int uid_t; | ||
typedef unsigned int gid_t; | ||
typedef unsigned long nlink_t; | ||
typedef signed long off_t; | ||
typedef signed long blksize_t; | ||
typedef signed long blkcnt_t; | ||
typedef signed long time_t; | ||
|
||
#endif /* _NOLIBC_STD_H */ |