From Advanced Programming in the UNIX® Environment:

For _PC_ASYNC_IO, _PC_PRIO_IO, and _PC_SYNC_IO, the referenced file must not be a directory.

Name of option   |   Indicates ...                          |name argument
_POSIX_SYNC_IO   |whether synchronized I/O can be used with |_PC_SYNC_IO
                  the associated file

So I assume the usage would be
long return_value = pathconf("/a/path/filename",_PC_SYNC_IO).

It looks like it's a way to get a specific file's "setting".

Is this thing can be set to a file? How can I set it?

And what does synchronized I/O mean as to a file? I mean, I don't understand how synchronized I/O could be a setting of a file? Shouldn't it be a programming aspect thing instead of merely a "setting"?

1 Answer 1


The result of pathconf can vary depending on the file, for some of the arguments it can be given (_PC_NAME_MAX, _PC_ASYNC_IO, and a few others), but for most arguments the result is a platform-dependent constant. The values you retrieve using pathconf aren’t per-file settings, they’re properties of the system and the type of file; you can’t set them.

Synchronized I/O in this context refers to synchronous reads and writes from and to a file, as controlled by O_SYNC and related flags which can be specified on open calls. pathconf(..., _PC_SYNC_IO) will tell you whether those flags are supported (note that O_SYNC is always supposed to be supported on regular files anyway, regardless of the result of pathconf).

  • So no matter what file I put into pathconf("/no/matter/what/file",_PC_SYNC_IO), the result would be the same? That's ... Oh god, then why requires the first argument at all..?
    – Rick
    Feb 21, 2019 at 15:31
  • It’s a generic interface which supports a variety of settings, some of which are path-dependent (e.g. because they depend on the type of the file). You’re not really supposed to know ahead of time that any given setting is a constant ;-). Feb 21, 2019 at 15:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .