Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(461)

Side by Side Diff: gdb/gnulib/import/m4/fcntl-o.m4

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gdb/gnulib/import/m4/extensions.m4 ('k') | gdb/gnulib/import/m4/fnmatch.m4 » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # fcntl-o.m4 serial 4
2 dnl Copyright (C) 2006, 2009-2012 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
6
7 dnl Written by Paul Eggert.
8
9 # Test whether the flags O_NOATIME and O_NOFOLLOW actually work.
10 # Define HAVE_WORKING_O_NOATIME to 1 if O_NOATIME works, or to 0 otherwise.
11 # Define HAVE_WORKING_O_NOFOLLOW to 1 if O_NOFOLLOW works, or to 0 otherwise.
12 AC_DEFUN([gl_FCNTL_O_FLAGS],
13 [
14 dnl Persuade glibc <fcntl.h> to define O_NOATIME and O_NOFOLLOW.
15 dnl AC_USE_SYSTEM_EXTENSIONS was introduced in autoconf 2.60 and obsoletes
16 dnl AC_GNU_SOURCE.
17 m4_ifdef([AC_USE_SYSTEM_EXTENSIONS],
18 [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])],
19 [AC_REQUIRE([AC_GNU_SOURCE])])
20
21 AC_CHECK_HEADERS_ONCE([unistd.h])
22 AC_CHECK_FUNCS_ONCE([symlink])
23 AC_CACHE_CHECK([for working fcntl.h], [gl_cv_header_working_fcntl_h],
24 [AC_RUN_IFELSE(
25 [AC_LANG_PROGRAM(
26 [[#include <sys/types.h>
27 #include <sys/stat.h>
28 #if HAVE_UNISTD_H
29 # include <unistd.h>
30 #else /* on Windows with MSVC */
31 # include <io.h>
32 # include <stdlib.h>
33 # defined sleep(n) _sleep ((n) * 1000)
34 #endif
35 #include <fcntl.h>
36 #ifndef O_NOATIME
37 #define O_NOATIME 0
38 #endif
39 #ifndef O_NOFOLLOW
40 #define O_NOFOLLOW 0
41 #endif
42 static int const constants[] =
43 {
44 O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, O_APPEND,
45 O_NONBLOCK, O_SYNC, O_ACCMODE, O_RDONLY, O_RDWR, O_WRONLY
46 };
47 ]],
48 [[
49 int result = !constants;
50 #if HAVE_SYMLINK
51 {
52 static char const sym[] = "conftest.sym";
53 if (symlink (".", sym) != 0)
54 result |= 2;
55 else
56 {
57 int fd = open (sym, O_RDONLY | O_NOFOLLOW);
58 if (fd >= 0)
59 {
60 close (fd);
61 result |= 4;
62 }
63 }
64 unlink (sym);
65 }
66 #endif
67 {
68 static char const file[] = "confdefs.h";
69 int fd = open (file, O_RDONLY | O_NOATIME);
70 if (fd < 0)
71 result |= 8;
72 else
73 {
74 struct stat st0;
75 if (fstat (fd, &st0) != 0)
76 result |= 16;
77 else
78 {
79 char c;
80 sleep (1);
81 if (read (fd, &c, 1) != 1)
82 result |= 24;
83 else
84 {
85 if (close (fd) != 0)
86 result |= 32;
87 else
88 {
89 struct stat st1;
90 if (stat (file, &st1) != 0)
91 result |= 40;
92 else
93 if (st0.st_atime != st1.st_atime)
94 result |= 64;
95 }
96 }
97 }
98 }
99 }
100 return result;]])],
101 [gl_cv_header_working_fcntl_h=yes],
102 [case $? in #(
103 4) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #(
104 64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #(
105 68) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #(
106 *) gl_cv_header_working_fcntl_h='no';;
107 esac],
108 [gl_cv_header_working_fcntl_h=cross-compiling])])
109
110 case $gl_cv_header_working_fcntl_h in #(
111 *O_NOATIME* | no | cross-compiling) ac_val=0;; #(
112 *) ac_val=1;;
113 esac
114 AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOATIME], [$ac_val],
115 [Define to 1 if O_NOATIME works.])
116
117 case $gl_cv_header_working_fcntl_h in #(
118 *O_NOFOLLOW* | no | cross-compiling) ac_val=0;; #(
119 *) ac_val=1;;
120 esac
121 AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOFOLLOW], [$ac_val],
122 [Define to 1 if O_NOFOLLOW works.])
123 ])
OLDNEW
« no previous file with comments | « gdb/gnulib/import/m4/extensions.m4 ('k') | gdb/gnulib/import/m4/fnmatch.m4 » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698