-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Add sysexits.h header with BSD exit codes (total-18) #126112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be notified. If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers. If you have further questions, they may be answered by the LLVM GitHub User Guide. You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums. |
|
@llvm/pr-subscribers-libc @llvm/pr-subscribers-llvm-support Author: None (ajayrajsaini) ChangesThis pull request adds a new header file, SysExits.h, to the LLVM project. The header includes 18 BSD exit code. Full diff: https://github.com/llvm/llvm-project/pull/126112.diff 1 Files Affected:
diff --git a/llvm/include/llvm/Support/SysExits.h b/llvm/include/llvm/Support/SysExits.h
new file mode 100644
index 000000000000000..06b3ada101756e7
--- /dev/null
+++ b/llvm/include/llvm/Support/SysExits.h
@@ -0,0 +1,24 @@
+#ifndef SYSEXITS_H
+#define SYSEXITS_H
+
+// BSD Exit Codes (18 total) — These are the commonly used exit codes without POSIX dependencies
+#define EX_OK 0 // Successful termination
+#define EX_USAGE 64 // Command line usage error
+#define EX_DATAERR 65 // Data format error
+#define EX_NOINPUT 66 // Cannot open input
+#define EX_NOUSER 67 // Addressee unknown
+#define EX_NOHOST 68 // Host name unknown
+#define EX_UNAVAILABLE 69 // Service unavailable
+#define EX_SOFTWARE 70 // Internal software error
+#define EX_OSERR 71 // Operating system error
+#define EX_OSFILE 72 // System file error
+#define EX_CANTCREAT 73 // Cannot create (user) output file
+#define EX_IOERR 74 // Input/output error
+#define EX_TEMPFAIL 75 // Temporary failure, try again
+#define EX_PROTOCOL 76 // Remote protocol error
+#define EX_NOPERM 77 // Permission denied
+#define EX_CONFIG 78 // Configuration error
+#define EX_INTERNAL 80 // Internal error
+#define EX_INVALIDARG 81 // Invalid argument
+
+#endif // SYSEXITS_H
|
nickdesaulniers
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, sorry, the intent of #124640 was to provide sysexits.h to llvm-libc, (lib/), not llvm itself.
Specifically, that build failure isn't llvm's fault, it's only when building llvm on top of the nascent llvm-libc is the deficiency in llvm-libc exposed.
|
Hi @nickdesaulniers please review the PR and let me know if there is any changes needed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem to define the header, it just adds this file in the lib/ directory? Look at how we handle the other headers in include/. Specifically you'll want to understand the hdrgen utility and the config/<os>/headers.txt files.
|
6807164 is a good reference example on what adding a new header entails. The headers.txt files are what roots the generation of the headers into the build system. You can for now skip additions to libc/docs/, since I don't think I properly handle in docgen what to do for BSD extensions (docgen will error IIRC if you add things that aren't std C or POSIX). |
|
Hey @nickdesaulniers , @jhuber6 i had made the requested changes will you review it once |
| #define EX_INTERNAL 80 // Internal error | ||
| #define EX_INVALIDARG 81 // Invalid argument |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where did you find EX_INTERNAL and EX_INVALIDARG? glibc, bionic, and musl only have up to EX_CONFIG.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question still stands; if these are from a BSD, it would be good to know which BSD adds these two new symbolic constants.
…dards, removed EX_INTERNAL and EX_INVALIDARG
|
Hey @nickdesaulniers and @jhuber6 , |
|
@ajayrajsaini Do you mind resolving the conflict so that we can merge this PR? Thanks! |
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
michaelrj-google
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, @lntue do you want to merge it or should I?
You can go ahead, I'm away from the computer right now. |
|
@ajayrajsaini Congratulations on having your first Pull Request (PR) merged into the LLVM Project! Your changes will be combined with recent changes from other authors, then tested by our build bots. If there is a problem with a build, you may receive a report in an email or a comment on this PR. Please check whether problems have been caused by your change specifically, as the builds can include changes from many authors. It is not uncommon for your change to be included in a build that fails due to someone else's changes, or infrastructure issues. How to do this, and the rest of the post-merge process, is covered in detail here. If your change does cause a problem, it may be reverted, or you can revert it yourself. This is a normal part of LLVM development. You can fix your changes and open a new PR to merge them again. If you don't get any reports, no action is required from you. Your changes are working as expected, well done! |
This pull request adds a new header file, SysExits.h, to the LLVM project. The header includes 18 BSD exit code.