Skip to content
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

Cleanup #489

Merged
merged 20 commits into from
Jan 15, 2022
Merged

Cleanup #489

merged 20 commits into from
Jan 15, 2022

Conversation

alejandro-colomar
Copy link
Collaborator

@alejandro-colomar alejandro-colomar commented Jan 3, 2022

A few more cleanup changes :)

POSIX.1-2001 defines 'struct dirent' in <dirent.h>.  It replaces
the old 'struct direct' found in BSDs.  All of the systems that I
checked (including FreeBSD, NetBSD, and OpenBSD), now provide
<dirent.h> with 'struct dirent', as mandated by POSIX.

Since autoconf first checks <dirent.h> and only if it's missing it
checks other header files, it's clear that it will always find
<dirent.h>, so let's simplify.

GNU autoconf documentation declares this macro as obsolescent, and
acknowledges that all current systems with directory libraries
have <dirent.h>:
<https://www.gnu.org/software/autoconf/manual/autoconf-2.70/html_node/Particular-Headers.html>

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Use struct dirent directly.  See parent commit.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
GNU autoconf documentation marks this macro as obsolescent, as
current systems are compatible with POSIX.

Simplify code to unconditionally include <sys/wait.h>, and don't
redefine WIFEXITSTATUS() and WIFEXITED(), since they are mandated
by POSIX.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
The only place where the check was used was removed in 4e1afcd.

BTW, it was unnecessary, since strchr(3) is defined by:
POSIX.1-2001, C89, SVr4, and 4.3BSD.  Enough to rely on it.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
BTW, it was unnecessary, since POSIX.1-2001 defines the function.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
The macro HAVE_GETHOSTNAME is not being used anywhere.

BTW, the function is defined by SVr4, 4.4BSD, and POSIX.1-2001, so
it's likely that it is always available.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
The macro HAVE_GETTIMEOFDAY is not being used anywhere.

BTW, the function is defined by SVr4, 4.3BSD, and POSIX.1-2001, so
it's likely that it is always available.

POSIX.1-2008 marks it as obsolete, but only because
clock_gettime(2) provides more precission.  Since gettimeofday(3)
is in use by many big projects, and it has no obvious dangers,
it's likely that it will continue to exist even if it's outside of
the POSIX standard.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
The macro HAVE_SIGACTION is not being used anywhere.

BTW, the function is defined by SVr4 and POSIX.1-2001, so it's likely that it is always available.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
The macro HAVE_GETADDRINFO is not being used anywhere.

BTW, the function is defined by POSIX.1-2001 and RFC 2553, so it's likely that it is always available.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
The macro HAVE_RUSEROK is not being used anywhere.

As the Linux manual page says, ruserok(3) is present on the BDSs, Solaris, and many other systems.  This function appeared in 4.2BSD.  So we probably can rely on its existence.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
'uid_t' is defined by POSIX.1-2001 in <sys/types.h>.
It's unlikely to be missing.

See uid_t(3).

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
'off_t' is defined by POSIX.1-2001 in <sys/types.h>.
It's unlikely to be missing.

See off_t(3).

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
'pid_t' is defined by POSIX.1-2001 in <sys/types.h>.
It's unlikely to be missing.

See pid_t(3).

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
'mode_t' is defined by POSIX.1-2001 in <sys/types.h>.
It's unlikely to be missing.

See mode_t(3).

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
INTERACTIVE Systems Corporation Unix is no longer sold, and Sun
said (long ago) that it would drop support for it on 2006-07-23.
So this macro has been obsolete for more than a decade.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
As autoconf documentation says, this macro is obsolescent, as no
current systems have the bug in S_ISDIR, S_ISREG, etc..
The affected systems were Tektronix UTekV, Amdahl UTS, and
Motorola System V/88.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
All current compilers support C89's 'const' keyword.
Autoconf declares this macro as obsolescent.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
It is defined by POSIX.1-2001.  Let's assume it always exists.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Systems on which <sys/time.h> conflicted with <time.h> are obsolete.

This macro has been marked as obsolete by autoconf documentation.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
C89 and POSIX.1-2001 define signal(2) as returning a pointer to a
function returning 'void'.  K&R C signal(2) signature is obsolete.
Use 'void' directly.

Also, instead of writing the function pointer type explicitly, use
POSIX's 'sighandler_t'.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
# define S_ISDIR(x) ((x) & S_IFMT) == S_IFDIR)
# define S_ISREG(x) ((x) & S_IFMT) == S_IFREG)
# ifdef S_IFLNK
# define S_ISLNK(x) ((x) & S_IFMT) == S_IFLNK)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this macro doesn't even work due to unbalanced parenthesis.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good eye! :)

@alejandro-colomar
Copy link
Collaborator Author

alejandro-colomar commented Jan 14, 2022

Oops, I recently moved my repos from github to my own cgit server http://www.alejandro-colomar.es/src/. I forgot that I had this PR pending, and I don't know if I broke it, or if github keeps it in some cache for you. If you can't merge the PR, tell me and I can recreate the repository, and push the branch.

Otherwise, if you accept patches to the mailing list, I'll be happy to send a patch set there (and in fact I'd prefer this, if that's okay for you).

@hallyn
Copy link
Member

hallyn commented Jan 15, 2022

Thanks for doing all this research.

Github seems happy with this so I'll merge it. I'm definitely happy taking patches over the mailing list, though.

I'm considering keeping a mirror of this tree at sr.ht, and creating a dev mailing list for it there, as that would make CI against patches easier.

@hallyn hallyn merged commit fd5945e into shadow-maint:master Jan 15, 2022
@alejandro-colomar
Copy link
Collaborator Author

Great! I'm happy to help :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants