ssize_t is defined in sys/types.h.
Per the POSIX documentation:
NAME
sys/types.h – data types
SYNOPSIS
#include <sys/types.h>DESCRIPTION
The header shall define at least the following types:
…
ssize_tUsed for a count of bytes or an error indication.