Search code examples
clinuxtypesincludeposix

Where is ssize_t defined in Linux?


OS: Debian 9 (Linux 4.9)

Compiler: GCC 8.2

Currently I am including <stddef.h> (where size_t is defined) and <stdint.h> (where most integral types are defined), but I still don't have ssize_t.

Where is it defined?


Solution

  • 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_t

        Used for a count of bytes or an error indication.