[nginx] svn commit: r4476 - in trunk: auto src/os/unix
noreply at nginx.com
noreply at nginx.com
Mon Feb 13 16:13:21 UTC 2012
Author: defan
Date: 2012-02-13 16:13:21 +0000 (Mon, 13 Feb 2012)
New Revision: 4476
Log:
Added openat()/fstatat().
Modified:
trunk/auto/unix
trunk/src/os/unix/ngx_errno.h
trunk/src/os/unix/ngx_files.h
Modified: trunk/auto/unix
===================================================================
--- trunk/auto/unix 2012-02-13 15:41:11 UTC (rev 4475)
+++ trunk/auto/unix 2012-02-13 16:13:21 UTC (rev 4476)
@@ -731,3 +731,17 @@
ngx_feature_libs=
ngx_feature_test="sysconf(_SC_NPROCESSORS_ONLN)"
. auto/feature
+
+
+ngx_feature="openat(), fstatat()"
+ngx_feature_name="NGX_HAVE_OPENAT"
+ngx_feature_run=no
+ngx_feature_incs="#include <sys/types.h>
+ #include <sys/stat.h>
+ #include <fcntl.h>"
+ngx_feature_path=
+ngx_feature_libs=
+ngx_feature_test="struct stat sb;
+ openat(AT_FDCWD, \".\", O_RDONLY|O_NOFOLLOW);
+ fstatat(AT_FDCWD, \".\", &sb, AT_SYMLINK_NOFOLLOW);"
+. auto/feature
Modified: trunk/src/os/unix/ngx_errno.h
===================================================================
--- trunk/src/os/unix/ngx_errno.h 2012-02-13 15:41:11 UTC (rev 4475)
+++ trunk/src/os/unix/ngx_errno.h 2012-02-13 16:13:21 UTC (rev 4476)
@@ -48,6 +48,11 @@
#define NGX_EILSEQ EILSEQ
#define NGX_ENOMOREFILES 0
+#if (NGX_HAVE_OPENAT)
+#define NGX_EMLINK EMLINK
+#define NGX_ELOOP ELOOP
+#endif
+
#if (__hpux__)
#define NGX_EAGAIN EWOULDBLOCK
#else
Modified: trunk/src/os/unix/ngx_files.h
===================================================================
--- trunk/src/os/unix/ngx_files.h 2012-02-13 15:41:11 UTC (rev 4475)
+++ trunk/src/os/unix/ngx_files.h 2012-02-13 16:13:21 UTC (rev 4476)
@@ -76,6 +76,10 @@
#define NGX_FILE_APPEND O_WRONLY|O_APPEND
#define NGX_FILE_NONBLOCK O_NONBLOCK
+#if (NGX_HAVE_OPENAT)
+#define NGX_FILE_NOFOLLOW O_NOFOLLOW
+#endif
+
#define NGX_FILE_DEFAULT_ACCESS 0644
#define NGX_FILE_OWNER_ACCESS 0600
@@ -324,6 +328,21 @@
size_t ngx_fs_bsize(u_char *name);
+#if (NGX_HAVE_OPENAT)
+
+#define ngx_openat_file(fd, name, mode, create, access) \
+ openat(fd, (const char *) name, mode|create, access)
+
+#define ngx_openat_file_n "openat()"
+
+#define ngx_file_at_info(fd, name, sb, flag) \
+ fstatat(fd, (const char *) name, sb, flag)
+
+#define ngx_file_at_info_n "fstatat()"
+
+#endif
+
+
#define ngx_stderr STDERR_FILENO
#define ngx_set_stderr(fd) dup2(fd, STDERR_FILENO)
#define ngx_set_stderr_n "dup2(STDERR_FILENO)"
More information about the nginx-devel
mailing list