2 * compat.h - Tweaks for compatibility with non-Linux systems.
4 * Copyright (c) 2002 Richard Russon
5 * Copyright (c) 2002-2004 Anton Altaparmakov
6 * Copyright (c) 2008-2009 Szabolcs Szakacsits
7 * Copyright (c) 2019 Jean-Pierre Andre
9 * This program/include file is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as published
11 * by the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program/include file is distributed in the hope that it will be
15 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
16 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program (in the main directory of the NTFS-3G
21 * distribution in the file COPYING); if not, write to the Free Software
22 * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #ifndef _NTFS_COMPAT_H
26 #define _NTFS_COMPAT_H
31 #ifdef HAVE_SYS_PARAM_H
32 #include <sys/param.h>
35 #include <errno.h> /* ENODATA */
38 #define ENODATA ENOENT
42 #define ELIBBAD ENOEXEC
46 #define ELIBACC ENOENT
49 /* xattr APIs in macOS differs from Linux ones in that they expect the special
50 * error code ENOATTR to be returned when an attribute cannot be found. So
51 * define NTFS_NOXATTR_ERRNO to the appropriate "no xattr found" errno value for
53 #if defined(__APPLE__) || defined(__DARWIN__)
54 #define NTFS_NOXATTR_ERRNO ENOATTR
56 #define NTFS_NOXATTR_ERRNO ENODATA
64 extern int ffs(int i
);
68 extern int daemon(int nochdir
, int noclose
);
69 #endif /* HAVE_DAEMON */
72 extern char *strsep(char **stringp
, const char *delim
);
73 #endif /* HAVE_STRSEP */
77 #define HAVE_STDIO_H /* mimic config.h */
81 #define fdatasync commit
82 #define __inline__ inline
83 #define __attribute__(X) /*nothing*/
85 #else /* !defined WINDOWS */
88 #define O_BINARY 0 /* unix is binary by default */
91 #endif /* defined WINDOWS */
93 #endif /* defined _NTFS_COMPAT_H */