+.Pp
+In addition to the errors returned by the
+.Fn mkdir ,
+the
+.Fn mkdirat
+function may fail if:
+.Bl -tag -width Er
+.It Bq Er EBADF
+The
+.Fa path
+argument does not specify an absolute path and the
+.Fa fd
+argument is neither
+.Dv AT_FDCWD
+nor a valid file descriptor open for searching.
+.It Bq Er ENOTDIR
+The
+.Fa path
+argument is not an absolute path and
+.Fa fd
+is neither
+.Dv AT_FDCWD
+nor a file descriptor associated with a directory.
+.El
+.Sh EXAMPLE
+.Bd -literal -offset indent
+
+int main (int argc, const char * argv[])
+{
+ /* The behavior of mkdir is undefined for anything other than the "permission" bits */
+ if (mkdir("/tmp/blah", 0777))
+ perror("/tmp/blah");
+
+ /* So we need to set the sticky/executable bits explicitly with chmod after calling mkdir */
+ if (chmod("/tmp/blah", 07777))
+ perror("/tmp/blah");
+}
+
+.Ed