Remove <private/bsd_sys_param.h>.
It's hardly used, and the two most interesting users are clearer with
modern alignof() anyway.
Bug: 373789390
Change-Id: I52368ab372ee3afd4ed2dd8e373ff0223d59db0e
diff --git a/libc/bionic/fts.c b/libc/bionic/fts.c
index 1287267..c36835e 100644
--- a/libc/bionic/fts.c
+++ b/libc/bionic/fts.c
@@ -29,7 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/param.h> /* ALIGN */
#include <sys/stat.h>
#include <dirent.h>
@@ -37,6 +36,7 @@
#include <fcntl.h>
#include <fts.h>
#include <limits.h>
+#include <stdalign.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -912,10 +912,14 @@
* be careful that the stat structure is reasonably aligned. Since the
* fts_name field is declared to be of size 1, the fts_name pointer is
* namelen + 2 before the first possible address of the stat structure.
+ *
+ * We can't use the same trick FreeBSD uses here because our fts_name
+ * is a char[1] rather than a char*. This is also the reason we don't
+ * need to say `namelen + 1`. We just assume the worst alignment.
*/
len = sizeof(FTSENT) + namelen;
if (!ISSET(FTS_NOSTAT))
- len += sizeof(struct stat) + ALIGNBYTES;
+ len += alignof(struct stat) + sizeof(struct stat);
if ((p = calloc(1, len)) == NULL)
return (NULL);
@@ -923,7 +927,7 @@
p->fts_namelen = namelen;
p->fts_instr = FTS_NOINSTR;
if (!ISSET(FTS_NOSTAT))
- p->fts_statp = (struct stat *)ALIGN(p->fts_name + namelen + 2);
+ p->fts_statp = (struct stat *)__builtin_align_up(p->fts_name + namelen + 2, alignof(struct stat));
memcpy(p->fts_name, name, namelen);
return (p);