-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
zfs_main.c: fix unused variable error with GCC #14441
Conversation
zfs_setproctitle_init() is stubbed out on FreeBSD. Signed-off-by: Rob Wing <rob.fx907@gmail.com>
@ixhamza can you take a look at this. |
@@ -8672,7 +8672,6 @@ main(int argc, char **argv) | |||
int i = 0; | |||
const char *cmdname; | |||
char **newargv; | |||
extern char **environ; |
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 reminds me of aaa9a67. It is odd that people keep putting interesting declarations into main()
.
That said, I would prefer it if we followed the standard's recommendation here:
Applications should use the getenv() function rather than accessing the environment directly via either envp or environ.
https://pubs.opengroup.org/onlinepubs/9699919799/functions/environ.html
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.
Interestingly, glibc puts environ
behind #ifdef __USE_GNU
in unistd.h
. However, it has a __environ
that can be used without specifying __USE_GNU
. That is something that the Linux Standard Base appears to have invented:
https://refspecs.linuxbase.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/baselib---environ.html
It is portable across both glibc and musl libc, but it is not portable to non-Linux systems. Both illumos-gate and FreeBSD do not support it.
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.
If I understand your suggestion, that would require factoring out the **environ
out of the zfs_setproctitle_init()
function signature - is that correct?
Then **environ
would have to be exposed to lib/libzutil/os/linux/zutil_setproctitle.c` through some fashion?
Any ideas/preference?
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.
I misremembered what getenv()
does. On second thought, lets just go with this PR as is.
zfs_setproctitle_init() is stubbed out on FreeBSD. Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Reviewed-by: Ameer Hamza <ahamza@ixsystems.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu> Signed-off-by: Rob Wing <rob.fx907@gmail.com> Closes openzfs#14441
zfs_setproctitle_init() is stubbed out on FreeBSD. Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Reviewed-by: Ameer Hamza <ahamza@ixsystems.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu> Signed-off-by: Rob Wing <rob.fx907@gmail.com> Closes openzfs#14441
zfs_setproctitle_init() is stubbed out on FreeBSD. Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Reviewed-by: Ameer Hamza <ahamza@ixsystems.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu> Signed-off-by: Rob Wing <rob.fx907@gmail.com> Closes openzfs#14441
zfs_setproctitle_init() is stubbed out on FreeBSD. Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Reviewed-by: Ameer Hamza <ahamza@ixsystems.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu> Signed-off-by: Rob Wing <rob.fx907@gmail.com> Closes #14441
zfs_setproctitle_init() is stubbed out on FreeBSD. Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Reviewed-by: Ameer Hamza <ahamza@ixsystems.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu> Signed-off-by: Rob Wing <rob.fx907@gmail.com> Closes openzfs#14441
zfs_setproctitle_init() is stubbed out on FreeBSD. Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Reviewed-by: Ameer Hamza <ahamza@ixsystems.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu> Signed-off-by: Rob Wing <rob.fx907@gmail.com> Closes openzfs#14441
Fix the following error when building with GCC on FreeBSD:
Motivation and Context
Description
How Has This Been Tested?
Types of changes
Checklist:
Signed-off-by
.