file.c needs limits.h for PATH_MAX and unistd.h for close(), isatty(), lseek(), SEEK_SET, ... binary.c also uses SEEK_SET.
unistd.h is currently pulled in via zlib's zconf.h, which feels wrong. Index: binary.c =================================================================== RCS file: /cvs/src/usr.bin/grep/binary.c,v retrieving revision 1.19 diff -u -p -r1.19 binary.c --- binary.c 10 Mar 2021 21:55:22 -0000 1.19 +++ binary.c 26 Jun 2021 20:47:22 -0000 @@ -30,6 +30,7 @@ #include <err.h> #include <stdio.h> #include <string.h> +#include <unistd.h> #include <zlib.h> #include "grep.h" Index: file.c =================================================================== RCS file: /cvs/src/usr.bin/grep/file.c,v retrieving revision 1.16 diff -u -p -r1.16 file.c --- file.c 10 Mar 2021 21:55:22 -0000 1.16 +++ file.c 15 Dec 2021 18:46:40 -0000 @@ -30,8 +30,10 @@ #include <err.h> #include <errno.h> #include <fcntl.h> +#include <limits.h> #include <stdio.h> #include <stdlib.h> +#include <unistd.h> #include <zlib.h> #include "grep.h"