Skip to content

Commit 9a65dc9

Browse files
authored
Add sysexits.h header with BSD exit codes (total-18) (#126112)
This pull request adds a new header file, SysExits.h, to the LLVM project. The header includes 18 BSD exit code.
1 parent 410a5b1 commit 9a65dc9

File tree

7 files changed

+75
-0
lines changed

7 files changed

+75
-0
lines changed

libc/config/linux/aarch64/headers.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ set(TARGET_PUBLIC_HEADERS
2929
libc.include.sys_socket
3030
libc.include.sys_syscall
3131
libc.include.sys_time
32+
libc.include.sysexits
3233
libc.include.sys_wait
3334
libc.include.threads
3435
libc.include.time

libc/config/linux/x86_64/headers.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ set(TARGET_PUBLIC_HEADERS
5050
libc.include.sys_types
5151
libc.include.sys_utsname
5252
libc.include.sys_wait
53+
libc.include.sysexits
5354
libc.include.termios
5455
libc.include.threads
5556
libc.include.time

libc/include/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,16 @@ add_header_macro(
168168
.llvm-libc-types.stdfix-types
169169
)
170170

171+
172+
add_header_macro(
173+
sysexits
174+
../libc/include/sysexits.yaml
175+
sysexits.h
176+
DEPENDS
177+
.llvm-libc-macros.sysexits_macros
178+
)
179+
180+
171181
# TODO: This should be conditional on POSIX networking being included.
172182
file(MAKE_DIRECTORY ${LIBC_INCLUDE_DIR}/arpa)
173183

libc/include/llvm-libc-macros/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,3 +343,10 @@ add_macro_header(
343343
HDR
344344
EFIAPI-macros.h
345345
)
346+
347+
add_macro_header(
348+
sysexits_macros
349+
HDR
350+
sysexits-macros.h
351+
)
352+
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//===-- Macros defined in sysexits.h header file --------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef SYSEXITS_MACROS_H
10+
#define SYSEXITS_MACROS_H
11+
12+
#define EX_OK 0 // Successful termination
13+
#define EX_USAGE 64 // Command line usage error
14+
#define EX_DATAERR 65 // Data format error
15+
#define EX_NOINPUT 66 // Cannot open input
16+
#define EX_NOUSER 67 // Addressee unknown
17+
#define EX_NOHOST 68 // Host name unknown
18+
#define EX_UNAVAILABLE 69 // Service unavailable
19+
#define EX_SOFTWARE 70 // Internal software error
20+
#define EX_OSERR 71 // Operating system error
21+
#define EX_OSFILE 72 // System file error
22+
#define EX_CANTCREAT 73 // Cannot create (user) output file
23+
#define EX_IOERR 74 // Input/output error
24+
#define EX_TEMPFAIL 75 // Temporary failure, try again
25+
#define EX_PROTOCOL 76 // Remote protocol error
26+
#define EX_NOPERM 77 // Permission denied
27+
#define EX_CONFIG 78 // Configuration error
28+
29+
#endif // SYSEXITS_MACROS_H

libc/include/sysexits.h.def

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//===-- POSIX header sysexits.h -----------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
#ifndef LLVM_LIBC_SYSEXITS_H
9+
#define LLVM_LIBC_SYSEXITS_H
10+
11+
#include "__llvm-libc-common.h"
12+
#include "llvm-libc-macros/sysexits-macros.h"
13+
14+
%%public_api()
15+
16+
#endif // LLVM_LIBC_SYSEXITS_H
17+

libc/include/sysexits.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
header: sysexits.h
2+
header_template: sysexits.h.def
3+
standards:
4+
- BSDExtensions
5+
- GNUExtensions
6+
macros: []
7+
types: []
8+
enums: []
9+
objects: []
10+
functions: []

0 commit comments

Comments
 (0)