libc: Switch open to use a mode_t on unix

While I'm at it, export O_SYNC with the other flags that are exported.

Closes #15582