Line | Count | Source |
1 | | #ifndef COMPAT_POSIX_H |
2 | | #define COMPAT_POSIX_H |
3 | | |
4 | | #define _FILE_OFFSET_BITS 64 |
5 | | |
6 | | /* |
7 | | * Derived from Linux "Features Test Macro" header |
8 | | * Convenience macros to test the versions of gcc (or |
9 | | * a compatible compiler). |
10 | | * Use them like this: |
11 | | * #if GIT_GNUC_PREREQ (2,8) |
12 | | * ... code requiring gcc 2.8 or later ... |
13 | | * #endif |
14 | | * |
15 | | * This macro of course is not part of POSIX, but we need it for the UNUSED |
16 | | * macro which is used by some of our POSIX compatibility wrappers. |
17 | | */ |
18 | | #if defined(__GNUC__) && defined(__GNUC_MINOR__) |
19 | | # define GIT_GNUC_PREREQ(maj, min) \ |
20 | | ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) |
21 | | #else |
22 | | #define GIT_GNUC_PREREQ(maj, min) 0 |
23 | | #endif |
24 | | |
25 | | /* |
26 | | * UNUSED marks a function parameter that is always unused. It also |
27 | | * can be used to annotate a function, a variable, or a type that is |
28 | | * always unused. |
29 | | * |
30 | | * A callback interface may dictate that a function accepts a |
31 | | * parameter at that position, but the implementation of the function |
32 | | * may not need to use the parameter. In such a case, mark the parameter |
33 | | * with UNUSED. |
34 | | * |
35 | | * When a parameter may be used or unused, depending on conditional |
36 | | * compilation, consider using MAYBE_UNUSED instead. |
37 | | */ |
38 | | #if GIT_GNUC_PREREQ(4, 5) |
39 | | #define UNUSED __attribute__((unused)) \ |
40 | | __attribute__((deprecated ("parameter declared as UNUSED"))) |
41 | | #elif defined(__GNUC__) |
42 | | #define UNUSED __attribute__((unused)) \ |
43 | | __attribute__((deprecated)) |
44 | | #else |
45 | | #define UNUSED |
46 | | #endif |
47 | | |
48 | | #ifdef __MINGW64__ |
49 | | #define _POSIX_C_SOURCE 1 |
50 | | #elif defined(__sun__) |
51 | | /* |
52 | | * On Solaris, when _XOPEN_EXTENDED is set, its header file |
53 | | * forces the programs to be XPG4v2, defeating any _XOPEN_SOURCE |
54 | | * setting to say we are XPG5 or XPG6. Also on Solaris, |
55 | | * XPG6 programs must be compiled with a c99 compiler, while |
56 | | * non XPG6 programs must be compiled with a pre-c99 compiler. |
57 | | */ |
58 | | # if __STDC_VERSION__ - 0 >= 199901L |
59 | | # define _XOPEN_SOURCE 600 |
60 | | # else |
61 | | # define _XOPEN_SOURCE 500 |
62 | | # endif |
63 | | #elif !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__NetBSD__) && \ |
64 | | !defined(__OpenBSD__) && !defined(__DragonFly__) && !defined(__MirBSD__) && \ |
65 | | !defined(__USLC__) && !defined(_M_UNIX) && !defined(__sgi) && \ |
66 | | !defined(__TANDEM) && !defined(__QNX__) && !defined(__CYGWIN__) |
67 | | #define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500 */ |
68 | | #define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */ |
69 | | #endif |
70 | | #define _ALL_SOURCE 1 |
71 | | #define _GNU_SOURCE 1 |
72 | | #define _BSD_SOURCE 1 |
73 | | #define _DEFAULT_SOURCE 1 |
74 | | #define _NETBSD_SOURCE 1 |
75 | | #define _SGI_SOURCE 1 |
76 | | |
77 | | #if defined(WIN32) && !defined(__CYGWIN__) /* Both MinGW and MSVC */ |
78 | | # if !defined(_WIN32_WINNT) |
79 | | # define _WIN32_WINNT 0x0600 |
80 | | # endif |
81 | | #define WIN32_LEAN_AND_MEAN /* stops windows.h including winsock.h */ |
82 | | #include <winsock2.h> |
83 | | #ifndef NO_UNIX_SOCKETS |
84 | | #include <afunix.h> |
85 | | #endif |
86 | | #include <windows.h> |
87 | | #define GIT_WINDOWS_NATIVE |
88 | | #endif |
89 | | |
90 | | #include <unistd.h> |
91 | | #include <stdio.h> |
92 | | #include <sys/stat.h> |
93 | | #include <fcntl.h> |
94 | | #include <stddef.h> |
95 | | #include <stdlib.h> |
96 | | #include <stdarg.h> |
97 | | #include <stdbool.h> |
98 | | #include <string.h> |
99 | | #ifdef HAVE_STRINGS_H |
100 | | #include <strings.h> /* for strcasecmp() */ |
101 | | #endif |
102 | | #include <errno.h> |
103 | | #include <limits.h> |
104 | | #include <locale.h> |
105 | | #ifdef NEEDS_SYS_PARAM_H |
106 | | #include <sys/param.h> |
107 | | #endif |
108 | | #include <sys/types.h> |
109 | | #include <dirent.h> |
110 | | #include <sys/time.h> |
111 | | #include <time.h> |
112 | | #include <signal.h> |
113 | | #include <assert.h> |
114 | | #include <regex.h> |
115 | | #include <utime.h> |
116 | | #include <syslog.h> |
117 | | #if !defined(NO_POLL_H) |
118 | | #include <poll.h> |
119 | | #elif !defined(NO_SYS_POLL_H) |
120 | | #include <sys/poll.h> |
121 | | #else |
122 | | /* Pull the compat stuff */ |
123 | | #include <poll.h> |
124 | | #endif |
125 | | #ifdef HAVE_BSD_SYSCTL |
126 | | #include <sys/sysctl.h> |
127 | | #endif |
128 | | |
129 | | #if defined(__MINGW32__) |
130 | | #include "mingw-posix.h" |
131 | | #elif defined(_MSC_VER) |
132 | | #include "msvc-posix.h" |
133 | | #else |
134 | | #include <sys/utsname.h> |
135 | | #include <sys/wait.h> |
136 | | #include <sys/resource.h> |
137 | | #include <sys/socket.h> |
138 | | #include <sys/ioctl.h> |
139 | | #include <sys/statvfs.h> |
140 | | #include <termios.h> |
141 | | #ifndef NO_SYS_SELECT_H |
142 | | #include <sys/select.h> |
143 | | #endif |
144 | | #include <netinet/in.h> |
145 | | #include <netinet/tcp.h> |
146 | | #include <arpa/inet.h> |
147 | | #include <netdb.h> |
148 | | #include <pwd.h> |
149 | | #include <sys/un.h> |
150 | | #ifndef NO_INTTYPES_H |
151 | | #include <inttypes.h> |
152 | | #else |
153 | | #include <stdint.h> |
154 | | #endif |
155 | | #ifdef HAVE_ARC4RANDOM_LIBBSD |
156 | | #include <bsd/stdlib.h> |
157 | | #endif |
158 | | #ifdef HAVE_GETRANDOM |
159 | | #include <sys/random.h> |
160 | | #endif |
161 | | #ifdef NO_INTPTR_T |
162 | | /* |
163 | | * On I16LP32, ILP32 and LP64 "long" is the safe bet, however |
164 | | * on LLP86, IL33LLP64 and P64 it needs to be "long long", |
165 | | * while on IP16 and IP16L32 it is "int" (resp. "short") |
166 | | * Size needs to match (or exceed) 'sizeof(void *)'. |
167 | | * We can't take "long long" here as not everybody has it. |
168 | | */ |
169 | | typedef long intptr_t; |
170 | | typedef unsigned long uintptr_t; |
171 | | #endif |
172 | | #undef _ALL_SOURCE /* AIX 5.3L defines a struct list with _ALL_SOURCE. */ |
173 | | #include <grp.h> |
174 | | #define _ALL_SOURCE 1 |
175 | | #endif |
176 | | |
177 | | #ifdef MKDIR_WO_TRAILING_SLASH |
178 | | #define mkdir(a,b) compat_mkdir_wo_trailing_slash((a),(b)) |
179 | | int compat_mkdir_wo_trailing_slash(const char*, mode_t); |
180 | | #endif |
181 | | |
182 | | #ifdef time |
183 | | #undef time |
184 | | #endif |
185 | | static inline time_t git_time(time_t *tloc) |
186 | 13.2k | { |
187 | 13.2k | struct timeval tv; |
188 | | |
189 | | /* |
190 | | * Avoid time(NULL), which can disagree with gettimeofday(2) |
191 | | * and filesystem timestamps. |
192 | | */ |
193 | 13.2k | gettimeofday(&tv, NULL); |
194 | | |
195 | 13.2k | if (tloc) |
196 | 0 | *tloc = tv.tv_sec; |
197 | 13.2k | return tv.tv_sec; |
198 | 13.2k | } Unexecuted instantiation: fuzz-date.c:git_time Unexecuted instantiation: dummy-cmd-main.c:git_time Line | Count | Source | 186 | 13.2k | { | 187 | 13.2k | struct timeval tv; | 188 | | | 189 | | /* | 190 | | * Avoid time(NULL), which can disagree with gettimeofday(2) | 191 | | * and filesystem timestamps. | 192 | | */ | 193 | 13.2k | gettimeofday(&tv, NULL); | 194 | | | 195 | 13.2k | if (tloc) | 196 | 0 | *tloc = tv.tv_sec; | 197 | 13.2k | return tv.tv_sec; | 198 | 13.2k | } |
Unexecuted instantiation: gettext.c:git_time Unexecuted instantiation: pager.c:git_time Unexecuted instantiation: parse.c:git_time Unexecuted instantiation: run-command.c:git_time Unexecuted instantiation: sigchain.c:git_time Unexecuted instantiation: strbuf.c:git_time Unexecuted instantiation: string-list.c:git_time Unexecuted instantiation: strvec.c:git_time Unexecuted instantiation: symlinks.c:git_time Unexecuted instantiation: trace.c:git_time Unexecuted instantiation: trace2.c:git_time Unexecuted instantiation: tr2_cfg.c:git_time Unexecuted instantiation: tr2_cmd_name.c:git_time Unexecuted instantiation: tr2_ctr.c:git_time Unexecuted instantiation: tr2_dst.c:git_time Unexecuted instantiation: tr2_sid.c:git_time Unexecuted instantiation: tr2_sysenv.c:git_time Unexecuted instantiation: tr2_tbuf.c:git_time Unexecuted instantiation: tr2_tgt_event.c:git_time Unexecuted instantiation: tr2_tgt_normal.c:git_time Unexecuted instantiation: tr2_tgt_perf.c:git_time Unexecuted instantiation: tr2_tls.c:git_time Unexecuted instantiation: tr2_tmr.c:git_time Unexecuted instantiation: usage.c:git_time Unexecuted instantiation: utf8.c:git_time Unexecuted instantiation: version.c:git_time Unexecuted instantiation: wildmatch.c:git_time Unexecuted instantiation: wrapper.c:git_time Unexecuted instantiation: procinfo.c:git_time Unexecuted instantiation: fopen.c:git_time Unexecuted instantiation: strlcpy.c:git_time Unexecuted instantiation: qsort_s.c:git_time Unexecuted instantiation: abspath.c:git_time Unexecuted instantiation: alias.c:git_time Unexecuted instantiation: common-exit.c:git_time Unexecuted instantiation: nonblock.c:git_time Unexecuted instantiation: not-constant.c:git_time Unexecuted instantiation: config.c:git_time Unexecuted instantiation: ctype.c:git_time Unexecuted instantiation: dir.c:git_time Unexecuted instantiation: editor.c:git_time Unexecuted instantiation: environment.c:git_time Unexecuted instantiation: ewah_bitmap.c:git_time Unexecuted instantiation: ewah_io.c:git_time Unexecuted instantiation: ewah_rlw.c:git_time Unexecuted instantiation: exec-cmd.c:git_time Unexecuted instantiation: fsmonitor.c:git_time Unexecuted instantiation: fsmonitor-ipc.c:git_time Unexecuted instantiation: fsmonitor-settings.c:git_time Unexecuted instantiation: hash.c:git_time Unexecuted instantiation: hashmap.c:git_time Unexecuted instantiation: hex.c:git_time Unexecuted instantiation: hex-ll.c:git_time Unexecuted instantiation: ident.c:git_time Unexecuted instantiation: json-writer.c:git_time Unexecuted instantiation: lockfile.c:git_time Unexecuted instantiation: mailmap.c:git_time Unexecuted instantiation: name-hash.c:git_time Unexecuted instantiation: object-file.c:git_time Unexecuted instantiation: object-name.c:git_time Unexecuted instantiation: object.c:git_time Unexecuted instantiation: odb.c:git_time Unexecuted instantiation: streaming.c:git_time Unexecuted instantiation: oid-array.c:git_time Unexecuted instantiation: oidmap.c:git_time Unexecuted instantiation: oidtree.c:git_time Unexecuted instantiation: pack-write.c:git_time Unexecuted instantiation: packfile.c:git_time Unexecuted instantiation: patch-delta.c:git_time Unexecuted instantiation: path.c:git_time Unexecuted instantiation: pathspec.c:git_time Unexecuted instantiation: pretty.c:git_time Unexecuted instantiation: prio-queue.c:git_time Unexecuted instantiation: promisor-remote.c:git_time Unexecuted instantiation: quote.c:git_time Unexecuted instantiation: read-cache.c:git_time Unexecuted instantiation: reflog-walk.c:git_time Unexecuted instantiation: refs.c:git_time Unexecuted instantiation: debug.c:git_time Unexecuted instantiation: files-backend.c:git_time Unexecuted instantiation: reftable-backend.c:git_time Unexecuted instantiation: iterator.c:git_time Unexecuted instantiation: packed-backend.c:git_time Unexecuted instantiation: ref-cache.c:git_time Unexecuted instantiation: error.c:git_time Unexecuted instantiation: fsck.c:git_time Unexecuted instantiation: iter.c:git_time Unexecuted instantiation: record.c:git_time Unexecuted instantiation: stack.c:git_time Unexecuted instantiation: system.c:git_time Unexecuted instantiation: table.c:git_time Unexecuted instantiation: writer.c:git_time Unexecuted instantiation: remote.c:git_time Unexecuted instantiation: replace-object.c:git_time Unexecuted instantiation: repo-settings.c:git_time Unexecuted instantiation: repository.c:git_time Unexecuted instantiation: resolve-undo.c:git_time Unexecuted instantiation: revision.c:git_time Unexecuted instantiation: setup.c:git_time Unexecuted instantiation: shallow.c:git_time Unexecuted instantiation: sparse-index.c:git_time Unexecuted instantiation: split-index.c:git_time Unexecuted instantiation: statinfo.c:git_time Unexecuted instantiation: strmap.c:git_time Unexecuted instantiation: submodule-config.c:git_time Unexecuted instantiation: submodule.c:git_time Unexecuted instantiation: tag.c:git_time Unexecuted instantiation: tempfile.c:git_time Unexecuted instantiation: thread-utils.c:git_time Unexecuted instantiation: tmp-objdir.c:git_time Unexecuted instantiation: trailer.c:git_time Unexecuted instantiation: transport.c:git_time Unexecuted instantiation: tree-diff.c:git_time Unexecuted instantiation: tree-walk.c:git_time Unexecuted instantiation: tree.c:git_time Unexecuted instantiation: url.c:git_time Unexecuted instantiation: urlmatch.c:git_time Unexecuted instantiation: varint.c:git_time Unexecuted instantiation: worktree.c:git_time Unexecuted instantiation: write-or-die.c:git_time Unexecuted instantiation: ws.c:git_time Unexecuted instantiation: wt-status.c:git_time Unexecuted instantiation: sha1dc_git.c:git_time Unexecuted instantiation: sha1.c:git_time Unexecuted instantiation: ubc_check.c:git_time Unexecuted instantiation: sha256.c:git_time Unexecuted instantiation: advice.c:git_time Unexecuted instantiation: alloc.c:git_time Unexecuted instantiation: attr.c:git_time Unexecuted instantiation: bisect.c:git_time Unexecuted instantiation: blob.c:git_time Unexecuted instantiation: bloom.c:git_time Unexecuted instantiation: branch.c:git_time Unexecuted instantiation: bundle-uri.c:git_time Unexecuted instantiation: bundle.c:git_time Unexecuted instantiation: cache-tree.c:git_time Unexecuted instantiation: cbtree.c:git_time Unexecuted instantiation: chdir-notify.c:git_time Unexecuted instantiation: chunk-format.c:git_time Unexecuted instantiation: color.c:git_time Unexecuted instantiation: column.c:git_time Unexecuted instantiation: combine-diff.c:git_time Unexecuted instantiation: commit-graph.c:git_time Unexecuted instantiation: commit-reach.c:git_time Unexecuted instantiation: commit.c:git_time Unexecuted instantiation: open.c:git_time Unexecuted instantiation: connect.c:git_time Unexecuted instantiation: connected.c:git_time Unexecuted instantiation: convert.c:git_time Unexecuted instantiation: copy.c:git_time Unexecuted instantiation: csum-file.c:git_time Unexecuted instantiation: decorate.c:git_time Unexecuted instantiation: diff-merges.c:git_time Unexecuted instantiation: diff-lib.c:git_time Unexecuted instantiation: diff.c:git_time Unexecuted instantiation: diffcore-break.c:git_time Unexecuted instantiation: diffcore-delta.c:git_time Unexecuted instantiation: diffcore-order.c:git_time Unexecuted instantiation: diffcore-pickaxe.c:git_time Unexecuted instantiation: diffcore-rename.c:git_time Unexecuted instantiation: diffcore-rotate.c:git_time Unexecuted instantiation: dir-iterator.c:git_time Unexecuted instantiation: bitmap.c:git_time Unexecuted instantiation: fetch-pack.c:git_time Unexecuted instantiation: git-zlib.c:git_time Unexecuted instantiation: gpg-interface.c:git_time Unexecuted instantiation: graph.c:git_time Unexecuted instantiation: grep.c:git_time Unexecuted instantiation: hash-lookup.c:git_time Unexecuted instantiation: hook.c:git_time Unexecuted instantiation: kwset.c:git_time Unexecuted instantiation: line-log.c:git_time Unexecuted instantiation: line-range.c:git_time Unexecuted instantiation: list-objects-filter-options.c:git_time Unexecuted instantiation: list-objects.c:git_time Unexecuted instantiation: log-tree.c:git_time Unexecuted instantiation: loose.c:git_time Unexecuted instantiation: mem-pool.c:git_time Unexecuted instantiation: merge-ll.c:git_time Unexecuted instantiation: merge-ort.c:git_time Unexecuted instantiation: midx.c:git_time Unexecuted instantiation: notes-cache.c:git_time Unexecuted instantiation: notes.c:git_time Unexecuted instantiation: object-file-convert.c:git_time Unexecuted instantiation: oidset.c:git_time Unexecuted instantiation: pack-check.c:git_time Unexecuted instantiation: pack-revindex.c:git_time Unexecuted instantiation: parse-options-cb.c:git_time Unexecuted instantiation: parse-options.c:git_time Unexecuted instantiation: patch-ids.c:git_time Unexecuted instantiation: pkt-line.c:git_time Unexecuted instantiation: preload-index.c:git_time Unexecuted instantiation: progress.c:git_time Unexecuted instantiation: protocol.c:git_time Unexecuted instantiation: range-diff.c:git_time Unexecuted instantiation: refspec.c:git_time Unexecuted instantiation: basics.c:git_time Unexecuted instantiation: block.c:git_time Unexecuted instantiation: blocksource.c:git_time Unexecuted instantiation: merged.c:git_time Unexecuted instantiation: pq.c:git_time Unexecuted instantiation: send-pack.c:git_time Unexecuted instantiation: sequencer.c:git_time Unexecuted instantiation: sideband.c:git_time Unexecuted instantiation: stable-qsort.c:git_time Unexecuted instantiation: sub-process.c:git_time Unexecuted instantiation: transport-helper.c:git_time Unexecuted instantiation: unpack-trees.c:git_time Unexecuted instantiation: userdiff.c:git_time Unexecuted instantiation: xdiff-interface.c:git_time Unexecuted instantiation: xdiffi.c:git_time Unexecuted instantiation: xemit.c:git_time Unexecuted instantiation: xhistogram.c:git_time Unexecuted instantiation: xmerge.c:git_time Unexecuted instantiation: xpatience.c:git_time Unexecuted instantiation: xprepare.c:git_time Unexecuted instantiation: xutils.c:git_time Unexecuted instantiation: apply.c:git_time Unexecuted instantiation: base85.c:git_time Unexecuted instantiation: diff-delta.c:git_time Unexecuted instantiation: entry.c:git_time Unexecuted instantiation: fetch-negotiator.c:git_time Unexecuted instantiation: linear-assignment.c:git_time Unexecuted instantiation: list-objects-filter.c:git_time Unexecuted instantiation: match-trees.c:git_time Unexecuted instantiation: merge-ort-wrappers.c:git_time Unexecuted instantiation: merge.c:git_time Unexecuted instantiation: default.c:git_time Unexecuted instantiation: noop.c:git_time Unexecuted instantiation: skipping.c:git_time Unexecuted instantiation: notes-utils.c:git_time Unexecuted instantiation: parallel-checkout.c:git_time Unexecuted instantiation: rebase-interactive.c:git_time Unexecuted instantiation: rerere.c:git_time Unexecuted instantiation: reset.c:git_time Unexecuted instantiation: fuzz-pack-headers.c:git_time Unexecuted instantiation: fuzz-credential-from-url-gently.c:git_time Unexecuted instantiation: credential.c:git_time Unexecuted instantiation: prompt.c:git_time Unexecuted instantiation: terminal.c:git_time Unexecuted instantiation: fuzz-config.c:git_time Unexecuted instantiation: fuzz-parse-attr-line.c:git_time Unexecuted instantiation: fuzz-commit-graph.c:git_time Unexecuted instantiation: fuzz-pack-idx.c:git_time Unexecuted instantiation: fuzz-url-decode-mem.c:git_time |
199 | 18.3k | #define time git_time |
200 | | |
201 | | #ifdef NO_STRUCT_ITIMERVAL |
202 | | struct itimerval { |
203 | | struct timeval it_interval; |
204 | | struct timeval it_value; |
205 | | }; |
206 | | #endif |
207 | | |
208 | | #ifdef NO_SETITIMER |
209 | | static inline int git_setitimer(int which UNUSED, |
210 | | const struct itimerval *value UNUSED, |
211 | | struct itimerval *newvalue UNUSED) { |
212 | | return 0; /* pretend success */ |
213 | | } |
214 | | #undef setitimer |
215 | | #define setitimer(which,value,ovalue) git_setitimer(which,value,ovalue) |
216 | | #endif |
217 | | |
218 | | #ifndef NO_LIBGEN_H |
219 | | #include <libgen.h> |
220 | | #else |
221 | | #define basename gitbasename |
222 | | char *gitbasename(char *); |
223 | | #define dirname gitdirname |
224 | | char *gitdirname(char *); |
225 | | #endif |
226 | | |
227 | | #ifndef NO_ICONV |
228 | | #include <iconv.h> |
229 | | #endif |
230 | | |
231 | | /* On most systems <netdb.h> would have given us this, but |
232 | | * not on some systems (e.g. z/OS). |
233 | | */ |
234 | | #ifndef NI_MAXHOST |
235 | | #define NI_MAXHOST 1025 |
236 | | #endif |
237 | | |
238 | | #ifndef NI_MAXSERV |
239 | | #define NI_MAXSERV 32 |
240 | | #endif |
241 | | |
242 | | /* On most systems <limits.h> would have given us this, but |
243 | | * not on some systems (e.g. GNU/Hurd). |
244 | | */ |
245 | | #ifndef PATH_MAX |
246 | | #define PATH_MAX 4096 |
247 | | #endif |
248 | | |
249 | | #ifndef NAME_MAX |
250 | | #define NAME_MAX 255 |
251 | | #endif |
252 | | |
253 | | typedef uintmax_t timestamp_t; |
254 | 50 | #define PRItime PRIuMAX |
255 | 113k | #define parse_timestamp strtoumax |
256 | 2.08k | #define TIME_MAX UINTMAX_MAX |
257 | | #define TIME_MIN 0 |
258 | | |
259 | | int lstat_cache_aware_rmdir(const char *path); |
260 | | #if !defined(__MINGW32__) && !defined(_MSC_VER) |
261 | 0 | #define rmdir lstat_cache_aware_rmdir |
262 | | #endif |
263 | | |
264 | | #if defined(NO_MMAP) || defined(USE_WIN32_MMAP) |
265 | | |
266 | | #ifndef PROT_READ |
267 | | #define PROT_READ 1 |
268 | | #define PROT_WRITE 2 |
269 | | #define MAP_PRIVATE 1 |
270 | | #endif |
271 | | |
272 | | #define mmap git_mmap |
273 | | #define munmap git_munmap |
274 | | void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset); |
275 | | int git_munmap(void *start, size_t length); |
276 | | |
277 | | #else /* NO_MMAP || USE_WIN32_MMAP */ |
278 | | |
279 | | #include <sys/mman.h> |
280 | | |
281 | | #endif /* NO_MMAP || USE_WIN32_MMAP */ |
282 | | |
283 | | #ifndef MAP_FAILED |
284 | | #define MAP_FAILED ((void *)-1) |
285 | | #endif |
286 | | |
287 | | #ifdef NEEDS_MODE_TRANSLATION |
288 | | #undef S_IFMT |
289 | | #undef S_IFREG |
290 | | #undef S_IFDIR |
291 | | #undef S_IFLNK |
292 | | #undef S_IFBLK |
293 | | #undef S_IFCHR |
294 | | #undef S_IFIFO |
295 | | #undef S_IFSOCK |
296 | | #define S_IFMT 0170000 |
297 | | #define S_IFREG 0100000 |
298 | | #define S_IFDIR 0040000 |
299 | | #define S_IFLNK 0120000 |
300 | | #define S_IFBLK 0060000 |
301 | | #define S_IFCHR 0020000 |
302 | | #define S_IFIFO 0010000 |
303 | | #define S_IFSOCK 0140000 |
304 | | #ifdef stat |
305 | | #undef stat |
306 | | #endif |
307 | | #define stat(path, buf) git_stat(path, buf) |
308 | | int git_stat(const char *, struct stat *); |
309 | | #ifdef fstat |
310 | | #undef fstat |
311 | | #endif |
312 | | #define fstat(fd, buf) git_fstat(fd, buf) |
313 | | int git_fstat(int, struct stat *); |
314 | | #ifdef lstat |
315 | | #undef lstat |
316 | | #endif |
317 | | #define lstat(path, buf) git_lstat(path, buf) |
318 | | int git_lstat(const char *, struct stat *); |
319 | | #endif |
320 | | |
321 | | #ifdef NO_PREAD |
322 | | #define pread git_pread |
323 | | ssize_t git_pread(int fd, void *buf, size_t count, off_t offset); |
324 | | #endif |
325 | | |
326 | | #ifdef NO_SETENV |
327 | | #define setenv gitsetenv |
328 | | int gitsetenv(const char *, const char *, int); |
329 | | #endif |
330 | | |
331 | | #ifdef NO_MKDTEMP |
332 | | #define mkdtemp git_mkdtemp |
333 | | #endif |
334 | | |
335 | | #ifdef NO_UNSETENV |
336 | | #define unsetenv gitunsetenv |
337 | | int gitunsetenv(const char *); |
338 | | #endif |
339 | | |
340 | | #ifdef NO_STRCASESTR |
341 | | #define strcasestr gitstrcasestr |
342 | | char *gitstrcasestr(const char *haystack, const char *needle); |
343 | | #endif |
344 | | |
345 | | #ifdef NO_STRLCPY |
346 | 0 | #define strlcpy gitstrlcpy |
347 | | size_t gitstrlcpy(char *, const char *, size_t); |
348 | | #endif |
349 | | |
350 | | #ifdef NO_STRTOUMAX |
351 | | #define strtoumax gitstrtoumax |
352 | | uintmax_t gitstrtoumax(const char *, char **, int); |
353 | | #define strtoimax gitstrtoimax |
354 | | intmax_t gitstrtoimax(const char *, char **, int); |
355 | | #endif |
356 | | |
357 | | #ifdef NO_HSTRERROR |
358 | | #define hstrerror githstrerror |
359 | | const char *githstrerror(int herror); |
360 | | #endif |
361 | | |
362 | | #ifdef NO_MEMMEM |
363 | | #define memmem gitmemmem |
364 | | void *gitmemmem(const void *haystack, size_t haystacklen, |
365 | | const void *needle, size_t needlelen); |
366 | | #endif |
367 | | |
368 | | #ifdef OVERRIDE_STRDUP |
369 | | #ifdef strdup |
370 | | #undef strdup |
371 | | #endif |
372 | | #define strdup gitstrdup |
373 | | char *gitstrdup(const char *s); |
374 | | #endif |
375 | | |
376 | | #ifdef NO_GETPAGESIZE |
377 | | #define getpagesize() sysconf(_SC_PAGESIZE) |
378 | | #endif |
379 | | |
380 | | #ifndef O_CLOEXEC |
381 | | #define O_CLOEXEC 0 |
382 | | #endif |
383 | | |
384 | | #ifdef FREAD_READS_DIRECTORIES |
385 | | # if !defined(SUPPRESS_FOPEN_REDEFINITION) |
386 | | # ifdef fopen |
387 | | # undef fopen |
388 | | # endif |
389 | 0 | # define fopen(a,b) git_fopen(a,b) |
390 | | # endif |
391 | | FILE *git_fopen(const char*, const char*); |
392 | | #endif |
393 | | |
394 | | #ifdef SNPRINTF_RETURNS_BOGUS |
395 | | #ifdef snprintf |
396 | | #undef snprintf |
397 | | #endif |
398 | | #define snprintf git_snprintf |
399 | | int git_snprintf(char *str, size_t maxsize, |
400 | | const char *format, ...); |
401 | | #ifdef vsnprintf |
402 | | #undef vsnprintf |
403 | | #endif |
404 | | #define vsnprintf git_vsnprintf |
405 | | int git_vsnprintf(char *str, size_t maxsize, |
406 | | const char *format, va_list ap); |
407 | | #endif |
408 | | |
409 | | #ifdef OPEN_RETURNS_EINTR |
410 | | #undef open |
411 | | #define open git_open_with_retry |
412 | | int git_open_with_retry(const char *path, int flag, ...); |
413 | | #endif |
414 | | |
415 | | #ifdef __GLIBC_PREREQ |
416 | | #if __GLIBC_PREREQ(2, 1) |
417 | | #define HAVE_STRCHRNUL |
418 | | #endif |
419 | | #endif |
420 | | |
421 | | #ifndef HAVE_STRCHRNUL |
422 | | #define strchrnul gitstrchrnul |
423 | | static inline char *gitstrchrnul(const char *s, int c) |
424 | | { |
425 | | while (*s && *s != c) |
426 | | s++; |
427 | | return (char *)s; |
428 | | } |
429 | | #endif |
430 | | |
431 | | #ifdef NO_INET_PTON |
432 | | int inet_pton(int af, const char *src, void *dst); |
433 | | #endif |
434 | | |
435 | | #ifdef NO_INET_NTOP |
436 | | const char *inet_ntop(int af, const void *src, char *dst, size_t size); |
437 | | #endif |
438 | | |
439 | | #ifdef NO_PTHREADS |
440 | | #define atexit git_atexit |
441 | | int git_atexit(void (*handler)(void)); |
442 | | #endif |
443 | | |
444 | | #ifndef HOST_NAME_MAX |
445 | | #define HOST_NAME_MAX 256 |
446 | | #endif |
447 | | |
448 | | #include "../sane-ctype.h" |
449 | | |
450 | | void git_stable_qsort(void *base, size_t nmemb, size_t size, |
451 | | int(*compar)(const void *, const void *)); |
452 | | #ifdef INTERNAL_QSORT |
453 | | #define qsort git_stable_qsort |
454 | | #endif |
455 | | |
456 | 0 | #define QSORT(base, n, compar) sane_qsort((base), (n), sizeof(*(base)), compar) |
457 | | static inline void sane_qsort(void *base, size_t nmemb, size_t size, |
458 | | int(*compar)(const void *, const void *)) |
459 | 0 | { |
460 | 0 | if (nmemb > 1) |
461 | 0 | qsort(base, nmemb, size, compar); |
462 | 0 | } Unexecuted instantiation: fuzz-date.c:sane_qsort Unexecuted instantiation: dummy-cmd-main.c:sane_qsort Unexecuted instantiation: date.c:sane_qsort Unexecuted instantiation: gettext.c:sane_qsort Unexecuted instantiation: pager.c:sane_qsort Unexecuted instantiation: parse.c:sane_qsort Unexecuted instantiation: run-command.c:sane_qsort Unexecuted instantiation: sigchain.c:sane_qsort Unexecuted instantiation: strbuf.c:sane_qsort Unexecuted instantiation: string-list.c:sane_qsort Unexecuted instantiation: strvec.c:sane_qsort Unexecuted instantiation: symlinks.c:sane_qsort Unexecuted instantiation: trace.c:sane_qsort Unexecuted instantiation: trace2.c:sane_qsort Unexecuted instantiation: tr2_cfg.c:sane_qsort Unexecuted instantiation: tr2_cmd_name.c:sane_qsort Unexecuted instantiation: tr2_ctr.c:sane_qsort Unexecuted instantiation: tr2_dst.c:sane_qsort Unexecuted instantiation: tr2_sid.c:sane_qsort Unexecuted instantiation: tr2_sysenv.c:sane_qsort Unexecuted instantiation: tr2_tbuf.c:sane_qsort Unexecuted instantiation: tr2_tgt_event.c:sane_qsort Unexecuted instantiation: tr2_tgt_normal.c:sane_qsort Unexecuted instantiation: tr2_tgt_perf.c:sane_qsort Unexecuted instantiation: tr2_tls.c:sane_qsort Unexecuted instantiation: tr2_tmr.c:sane_qsort Unexecuted instantiation: usage.c:sane_qsort Unexecuted instantiation: utf8.c:sane_qsort Unexecuted instantiation: version.c:sane_qsort Unexecuted instantiation: wildmatch.c:sane_qsort Unexecuted instantiation: wrapper.c:sane_qsort Unexecuted instantiation: procinfo.c:sane_qsort Unexecuted instantiation: fopen.c:sane_qsort Unexecuted instantiation: strlcpy.c:sane_qsort Unexecuted instantiation: qsort_s.c:sane_qsort Unexecuted instantiation: abspath.c:sane_qsort Unexecuted instantiation: alias.c:sane_qsort Unexecuted instantiation: common-exit.c:sane_qsort Unexecuted instantiation: nonblock.c:sane_qsort Unexecuted instantiation: not-constant.c:sane_qsort Unexecuted instantiation: config.c:sane_qsort Unexecuted instantiation: ctype.c:sane_qsort Unexecuted instantiation: dir.c:sane_qsort Unexecuted instantiation: editor.c:sane_qsort Unexecuted instantiation: environment.c:sane_qsort Unexecuted instantiation: ewah_bitmap.c:sane_qsort Unexecuted instantiation: ewah_io.c:sane_qsort Unexecuted instantiation: ewah_rlw.c:sane_qsort Unexecuted instantiation: exec-cmd.c:sane_qsort Unexecuted instantiation: fsmonitor.c:sane_qsort Unexecuted instantiation: fsmonitor-ipc.c:sane_qsort Unexecuted instantiation: fsmonitor-settings.c:sane_qsort Unexecuted instantiation: hash.c:sane_qsort Unexecuted instantiation: hashmap.c:sane_qsort Unexecuted instantiation: hex.c:sane_qsort Unexecuted instantiation: hex-ll.c:sane_qsort Unexecuted instantiation: ident.c:sane_qsort Unexecuted instantiation: json-writer.c:sane_qsort Unexecuted instantiation: lockfile.c:sane_qsort Unexecuted instantiation: mailmap.c:sane_qsort Unexecuted instantiation: name-hash.c:sane_qsort Unexecuted instantiation: object-file.c:sane_qsort Unexecuted instantiation: object-name.c:sane_qsort Unexecuted instantiation: object.c:sane_qsort Unexecuted instantiation: odb.c:sane_qsort Unexecuted instantiation: streaming.c:sane_qsort Unexecuted instantiation: oid-array.c:sane_qsort Unexecuted instantiation: oidmap.c:sane_qsort Unexecuted instantiation: oidtree.c:sane_qsort Unexecuted instantiation: pack-write.c:sane_qsort Unexecuted instantiation: packfile.c:sane_qsort Unexecuted instantiation: patch-delta.c:sane_qsort Unexecuted instantiation: path.c:sane_qsort Unexecuted instantiation: pathspec.c:sane_qsort Unexecuted instantiation: pretty.c:sane_qsort Unexecuted instantiation: prio-queue.c:sane_qsort Unexecuted instantiation: promisor-remote.c:sane_qsort Unexecuted instantiation: quote.c:sane_qsort Unexecuted instantiation: read-cache.c:sane_qsort Unexecuted instantiation: reflog-walk.c:sane_qsort Unexecuted instantiation: refs.c:sane_qsort Unexecuted instantiation: debug.c:sane_qsort Unexecuted instantiation: files-backend.c:sane_qsort Unexecuted instantiation: reftable-backend.c:sane_qsort Unexecuted instantiation: iterator.c:sane_qsort Unexecuted instantiation: packed-backend.c:sane_qsort Unexecuted instantiation: ref-cache.c:sane_qsort Unexecuted instantiation: error.c:sane_qsort Unexecuted instantiation: fsck.c:sane_qsort Unexecuted instantiation: iter.c:sane_qsort Unexecuted instantiation: record.c:sane_qsort Unexecuted instantiation: stack.c:sane_qsort Unexecuted instantiation: system.c:sane_qsort Unexecuted instantiation: table.c:sane_qsort Unexecuted instantiation: writer.c:sane_qsort Unexecuted instantiation: remote.c:sane_qsort Unexecuted instantiation: replace-object.c:sane_qsort Unexecuted instantiation: repo-settings.c:sane_qsort Unexecuted instantiation: repository.c:sane_qsort Unexecuted instantiation: resolve-undo.c:sane_qsort Unexecuted instantiation: revision.c:sane_qsort Unexecuted instantiation: setup.c:sane_qsort Unexecuted instantiation: shallow.c:sane_qsort Unexecuted instantiation: sparse-index.c:sane_qsort Unexecuted instantiation: split-index.c:sane_qsort Unexecuted instantiation: statinfo.c:sane_qsort Unexecuted instantiation: strmap.c:sane_qsort Unexecuted instantiation: submodule-config.c:sane_qsort Unexecuted instantiation: submodule.c:sane_qsort Unexecuted instantiation: tag.c:sane_qsort Unexecuted instantiation: tempfile.c:sane_qsort Unexecuted instantiation: thread-utils.c:sane_qsort Unexecuted instantiation: tmp-objdir.c:sane_qsort Unexecuted instantiation: trailer.c:sane_qsort Unexecuted instantiation: transport.c:sane_qsort Unexecuted instantiation: tree-diff.c:sane_qsort Unexecuted instantiation: tree-walk.c:sane_qsort Unexecuted instantiation: tree.c:sane_qsort Unexecuted instantiation: url.c:sane_qsort Unexecuted instantiation: urlmatch.c:sane_qsort Unexecuted instantiation: varint.c:sane_qsort Unexecuted instantiation: worktree.c:sane_qsort Unexecuted instantiation: write-or-die.c:sane_qsort Unexecuted instantiation: ws.c:sane_qsort Unexecuted instantiation: wt-status.c:sane_qsort Unexecuted instantiation: sha1dc_git.c:sane_qsort Unexecuted instantiation: sha1.c:sane_qsort Unexecuted instantiation: ubc_check.c:sane_qsort Unexecuted instantiation: sha256.c:sane_qsort Unexecuted instantiation: advice.c:sane_qsort Unexecuted instantiation: alloc.c:sane_qsort Unexecuted instantiation: attr.c:sane_qsort Unexecuted instantiation: bisect.c:sane_qsort Unexecuted instantiation: blob.c:sane_qsort Unexecuted instantiation: bloom.c:sane_qsort Unexecuted instantiation: branch.c:sane_qsort Unexecuted instantiation: bundle-uri.c:sane_qsort Unexecuted instantiation: bundle.c:sane_qsort Unexecuted instantiation: cache-tree.c:sane_qsort Unexecuted instantiation: cbtree.c:sane_qsort Unexecuted instantiation: chdir-notify.c:sane_qsort Unexecuted instantiation: chunk-format.c:sane_qsort Unexecuted instantiation: color.c:sane_qsort Unexecuted instantiation: column.c:sane_qsort Unexecuted instantiation: combine-diff.c:sane_qsort Unexecuted instantiation: commit-graph.c:sane_qsort Unexecuted instantiation: commit-reach.c:sane_qsort Unexecuted instantiation: commit.c:sane_qsort Unexecuted instantiation: open.c:sane_qsort Unexecuted instantiation: connect.c:sane_qsort Unexecuted instantiation: connected.c:sane_qsort Unexecuted instantiation: convert.c:sane_qsort Unexecuted instantiation: copy.c:sane_qsort Unexecuted instantiation: csum-file.c:sane_qsort Unexecuted instantiation: decorate.c:sane_qsort Unexecuted instantiation: diff-merges.c:sane_qsort Unexecuted instantiation: diff-lib.c:sane_qsort Unexecuted instantiation: diff.c:sane_qsort Unexecuted instantiation: diffcore-break.c:sane_qsort Unexecuted instantiation: diffcore-delta.c:sane_qsort Unexecuted instantiation: diffcore-order.c:sane_qsort Unexecuted instantiation: diffcore-pickaxe.c:sane_qsort Unexecuted instantiation: diffcore-rename.c:sane_qsort Unexecuted instantiation: diffcore-rotate.c:sane_qsort Unexecuted instantiation: dir-iterator.c:sane_qsort Unexecuted instantiation: bitmap.c:sane_qsort Unexecuted instantiation: fetch-pack.c:sane_qsort Unexecuted instantiation: git-zlib.c:sane_qsort Unexecuted instantiation: gpg-interface.c:sane_qsort Unexecuted instantiation: graph.c:sane_qsort Unexecuted instantiation: grep.c:sane_qsort Unexecuted instantiation: hash-lookup.c:sane_qsort Unexecuted instantiation: hook.c:sane_qsort Unexecuted instantiation: kwset.c:sane_qsort Unexecuted instantiation: line-log.c:sane_qsort Unexecuted instantiation: line-range.c:sane_qsort Unexecuted instantiation: list-objects-filter-options.c:sane_qsort Unexecuted instantiation: list-objects.c:sane_qsort Unexecuted instantiation: log-tree.c:sane_qsort Unexecuted instantiation: loose.c:sane_qsort Unexecuted instantiation: mem-pool.c:sane_qsort Unexecuted instantiation: merge-ll.c:sane_qsort Unexecuted instantiation: merge-ort.c:sane_qsort Unexecuted instantiation: midx.c:sane_qsort Unexecuted instantiation: notes-cache.c:sane_qsort Unexecuted instantiation: notes.c:sane_qsort Unexecuted instantiation: object-file-convert.c:sane_qsort Unexecuted instantiation: oidset.c:sane_qsort Unexecuted instantiation: pack-check.c:sane_qsort Unexecuted instantiation: pack-revindex.c:sane_qsort Unexecuted instantiation: parse-options-cb.c:sane_qsort Unexecuted instantiation: parse-options.c:sane_qsort Unexecuted instantiation: patch-ids.c:sane_qsort Unexecuted instantiation: pkt-line.c:sane_qsort Unexecuted instantiation: preload-index.c:sane_qsort Unexecuted instantiation: progress.c:sane_qsort Unexecuted instantiation: protocol.c:sane_qsort Unexecuted instantiation: range-diff.c:sane_qsort Unexecuted instantiation: refspec.c:sane_qsort Unexecuted instantiation: basics.c:sane_qsort Unexecuted instantiation: block.c:sane_qsort Unexecuted instantiation: blocksource.c:sane_qsort Unexecuted instantiation: merged.c:sane_qsort Unexecuted instantiation: pq.c:sane_qsort Unexecuted instantiation: send-pack.c:sane_qsort Unexecuted instantiation: sequencer.c:sane_qsort Unexecuted instantiation: sideband.c:sane_qsort Unexecuted instantiation: stable-qsort.c:sane_qsort Unexecuted instantiation: sub-process.c:sane_qsort Unexecuted instantiation: transport-helper.c:sane_qsort Unexecuted instantiation: unpack-trees.c:sane_qsort Unexecuted instantiation: userdiff.c:sane_qsort Unexecuted instantiation: xdiff-interface.c:sane_qsort Unexecuted instantiation: xdiffi.c:sane_qsort Unexecuted instantiation: xemit.c:sane_qsort Unexecuted instantiation: xhistogram.c:sane_qsort Unexecuted instantiation: xmerge.c:sane_qsort Unexecuted instantiation: xpatience.c:sane_qsort Unexecuted instantiation: xprepare.c:sane_qsort Unexecuted instantiation: xutils.c:sane_qsort Unexecuted instantiation: apply.c:sane_qsort Unexecuted instantiation: base85.c:sane_qsort Unexecuted instantiation: diff-delta.c:sane_qsort Unexecuted instantiation: entry.c:sane_qsort Unexecuted instantiation: fetch-negotiator.c:sane_qsort Unexecuted instantiation: linear-assignment.c:sane_qsort Unexecuted instantiation: list-objects-filter.c:sane_qsort Unexecuted instantiation: match-trees.c:sane_qsort Unexecuted instantiation: merge-ort-wrappers.c:sane_qsort Unexecuted instantiation: merge.c:sane_qsort Unexecuted instantiation: default.c:sane_qsort Unexecuted instantiation: noop.c:sane_qsort Unexecuted instantiation: skipping.c:sane_qsort Unexecuted instantiation: notes-utils.c:sane_qsort Unexecuted instantiation: parallel-checkout.c:sane_qsort Unexecuted instantiation: rebase-interactive.c:sane_qsort Unexecuted instantiation: rerere.c:sane_qsort Unexecuted instantiation: reset.c:sane_qsort Unexecuted instantiation: fuzz-pack-headers.c:sane_qsort Unexecuted instantiation: fuzz-credential-from-url-gently.c:sane_qsort Unexecuted instantiation: credential.c:sane_qsort Unexecuted instantiation: prompt.c:sane_qsort Unexecuted instantiation: terminal.c:sane_qsort Unexecuted instantiation: fuzz-config.c:sane_qsort Unexecuted instantiation: fuzz-parse-attr-line.c:sane_qsort Unexecuted instantiation: fuzz-commit-graph.c:sane_qsort Unexecuted instantiation: fuzz-pack-idx.c:sane_qsort Unexecuted instantiation: fuzz-url-decode-mem.c:sane_qsort |
463 | | |
464 | | #define STABLE_QSORT(base, n, compar) \ |
465 | 0 | git_stable_qsort((base), (n), sizeof(*(base)), compar) |
466 | | |
467 | | #ifndef HAVE_ISO_QSORT_S |
468 | | int git_qsort_s(void *base, size_t nmemb, size_t size, |
469 | | int (*compar)(const void *, const void *, void *), void *ctx); |
470 | 0 | #define qsort_s git_qsort_s |
471 | | #endif |
472 | | |
473 | 0 | #define QSORT_S(base, n, compar, ctx) do { \ |
474 | 0 | if (qsort_s((base), (n), sizeof(*(base)), compar, ctx)) \ |
475 | 0 | BUG("qsort_s() failed"); \ |
476 | 0 | } while (0) |
477 | | |
478 | | #ifdef NO_NSEC |
479 | | #undef USE_NSEC |
480 | | #define ST_CTIME_NSEC(st) 0 |
481 | | #define ST_MTIME_NSEC(st) 0 |
482 | | #else |
483 | | #ifdef USE_ST_TIMESPEC |
484 | | #define ST_CTIME_NSEC(st) ((unsigned int)((st).st_ctimespec.tv_nsec)) |
485 | | #define ST_MTIME_NSEC(st) ((unsigned int)((st).st_mtimespec.tv_nsec)) |
486 | | #else |
487 | 0 | #define ST_CTIME_NSEC(st) ((unsigned int)((st).st_ctim.tv_nsec)) |
488 | 0 | #define ST_MTIME_NSEC(st) ((unsigned int)((st).st_mtim.tv_nsec)) |
489 | | #endif |
490 | | #endif |
491 | | |
492 | | #ifndef va_copy |
493 | | /* |
494 | | * Since an obvious implementation of va_list would be to make it a |
495 | | * pointer into the stack frame, a simple assignment will work on |
496 | | * many systems. But let's try to be more portable. |
497 | | */ |
498 | | #ifdef __va_copy |
499 | | #define va_copy(dst, src) __va_copy(dst, src) |
500 | | #else |
501 | | #define va_copy(dst, src) ((dst) = (src)) |
502 | | #endif |
503 | | #endif |
504 | | |
505 | | #ifndef _POSIX_THREAD_SAFE_FUNCTIONS |
506 | | static inline void git_flockfile(FILE *fh UNUSED) |
507 | | { |
508 | | ; /* nothing */ |
509 | | } |
510 | | static inline void git_funlockfile(FILE *fh UNUSED) |
511 | | { |
512 | | ; /* nothing */ |
513 | | } |
514 | | #undef flockfile |
515 | | #undef funlockfile |
516 | | #undef getc_unlocked |
517 | | #define flockfile(fh) git_flockfile(fh) |
518 | | #define funlockfile(fh) git_funlockfile(fh) |
519 | | #define getc_unlocked(fh) getc(fh) |
520 | | #endif |
521 | | |
522 | | #ifdef FILENO_IS_A_MACRO |
523 | | int git_fileno(FILE *stream); |
524 | | # ifndef COMPAT_CODE_FILENO |
525 | | # undef fileno |
526 | | # define fileno(p) git_fileno(p) |
527 | | # endif |
528 | | #endif |
529 | | |
530 | | #ifdef NEED_ACCESS_ROOT_HANDLER |
531 | | int git_access(const char *path, int mode); |
532 | | # ifndef COMPAT_CODE_ACCESS |
533 | | # ifdef access |
534 | | # undef access |
535 | | # endif |
536 | | # define access(path, mode) git_access(path, mode) |
537 | | # endif |
538 | | #endif |
539 | | |
540 | | #endif /* COMPAT_POSIX_H */ |