mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-27 03:19:35 +03:00
510ee280c0
Even on Illumos it's only available in the 32-bit programming environment, and, quoth enable_extended_FILE_stdio(3C): > Historically, 32-bit Solaris applications have been limited to using > only the file descriptors 0 through 255 with the standard I/O > functions (see stdio(3C)) in the C library. The extended FILE > facility allows well-behaved 32-bit applications to use any > valid file descriptor with the standard I/O functions. where "well-behaved" means that it > does not directly access any fields in the FILE structure pointed > to by the FILE pointer associated with any standard I/O stream, And the stdio/flush.c implementation reads: /* * if this is not an internal extended FILE then check * if _file is being changed from underneath us. * It should not be because if * it is then then we lose our ability to guard against * silent data corruption. */ if (!iop->__xf_nocheck && bad_fd > -1 && iop->_magic != bad_fd) { (void) fprintf(stderr, "Application violated extended FILE safety mechanism.\n" "Please read the man page for extendedFILE.\nAborting\n"); abort(); } This appears to be an insane workaround for broken implementation with exposed FILE internals and _file being an u8, both only on non-LP64; it's shimmed out on all LP64 targets in Illumos, and we shim it out as well: just get rid of it This appears to've been originally fixed in illumos-gate a5f69788de7ac07553de47f7fec8c05a9a94c105 ("PSARC 2006/162 Extended FILE space for 32-bit Solaris processes", "1085341 32-bit stdio routines should support file descriptors >255"), which also bears extendedFILE and enable_extended_FILE_stdio(3C): - unsigned char _file; /* UNIX System file descriptor */ + unsigned char _magic; /* Old home of the file descriptor */ + /* Only fileno(3C) can retrieve the value now */ and +/* + * Macros to aid the extended fd FILE work. + * This helps isolate the changes to only the 32-bit code + * since 64-bit Solaris is not affected by this. + */ +#ifdef _LP64 +#define GET_FD(iop) ((iop)->_file) +#define SET_FILE(iop, fd) ((iop)->_file = (fd)) +#else +#define GET_FD(iop) \ + (((iop)->__extendedfd) ? _file_get(iop) : (iop)->_magic) +#define SET_FILE(iop, fd) (iop)->_magic = (fd); (iop)->__extendedfd = 0 +#endif Also remove the 1k setrlimit(NOFILE) calls: that's the default on Linux, with 64k on Illumos and 171k on FreeBSD Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #13411
108 lines
2.1 KiB
Makefile
108 lines
2.1 KiB
Makefile
libspldir = $(includedir)/libspl
|
|
libspl_HEADERS = \
|
|
%D%/assert.h \
|
|
%D%/atomic.h \
|
|
%D%/libdevinfo.h \
|
|
%D%/libgen.h \
|
|
%D%/libshare.h \
|
|
%D%/limits.h \
|
|
%D%/locale.h \
|
|
%D%/statcommon.h \
|
|
%D%/stdlib.h \
|
|
%D%/string.h \
|
|
%D%/stropts.h \
|
|
%D%/thread.h \
|
|
%D%/tzfile.h \
|
|
%D%/ucred.h \
|
|
%D%/umem.h \
|
|
%D%/unistd.h \
|
|
%D%/zone.h
|
|
|
|
if BUILD_FREEBSD
|
|
libspl_HEADERS += \
|
|
%D%/os/freebsd/fcntl.h
|
|
endif
|
|
|
|
|
|
libspl_rpcdir = $(libspldir)/rpc
|
|
libspl_rpc_HEADERS = \
|
|
%D%/rpc/xdr.h
|
|
|
|
|
|
libspl_sysdir = $(libspldir)/sys
|
|
libspl_sys_HEADERS = \
|
|
%D%/sys/acl.h \
|
|
%D%/sys/acl_impl.h \
|
|
%D%/sys/callb.h \
|
|
%D%/sys/cmn_err.h \
|
|
%D%/sys/cred.h \
|
|
%D%/sys/debug.h \
|
|
%D%/sys/dkio.h \
|
|
%D%/sys/dklabel.h \
|
|
%D%/sys/feature_tests.h \
|
|
%D%/sys/int_limits.h \
|
|
%D%/sys/int_types.h \
|
|
%D%/sys/inttypes.h \
|
|
%D%/sys/isa_defs.h \
|
|
%D%/sys/kmem.h \
|
|
%D%/sys/kstat.h \
|
|
%D%/sys/list.h \
|
|
%D%/sys/list_impl.h \
|
|
%D%/sys/mhd.h \
|
|
%D%/sys/mkdev.h \
|
|
%D%/sys/policy.h \
|
|
%D%/sys/poll.h \
|
|
%D%/sys/priv.h \
|
|
%D%/sys/processor.h \
|
|
%D%/sys/sha2.h \
|
|
%D%/sys/simd.h \
|
|
%D%/sys/stack.h \
|
|
%D%/sys/stdtypes.h \
|
|
%D%/sys/string.h \
|
|
%D%/sys/stropts.h \
|
|
%D%/sys/sunddi.h \
|
|
%D%/sys/systeminfo.h \
|
|
%D%/sys/time.h \
|
|
%D%/sys/trace_spl.h \
|
|
%D%/sys/trace_zfs.h \
|
|
%D%/sys/types.h \
|
|
%D%/sys/types32.h \
|
|
%D%/sys/tzfile.h \
|
|
%D%/sys/uio.h \
|
|
%D%/sys/va_list.h \
|
|
%D%/sys/varargs.h \
|
|
%D%/sys/vnode.h \
|
|
%D%/sys/wmsum.h \
|
|
%D%/sys/zone.h
|
|
|
|
if BUILD_LINUX
|
|
libspl_sys_HEADERS += \
|
|
%D%/os/linux/sys/byteorder.h \
|
|
%D%/os/linux/sys/errno.h \
|
|
%D%/os/linux/sys/mnttab.h \
|
|
%D%/os/linux/sys/mount.h \
|
|
%D%/os/linux/sys/param.h \
|
|
%D%/os/linux/sys/stat.h \
|
|
%D%/os/linux/sys/sysmacros.h \
|
|
%D%/os/linux/sys/zfs_context_os.h
|
|
endif
|
|
|
|
if BUILD_FREEBSD
|
|
libspl_sys_HEADERS += \
|
|
%D%/os/freebsd/sys/byteorder.h \
|
|
%D%/os/freebsd/sys/fcntl.h \
|
|
%D%/os/freebsd/sys/file.h \
|
|
%D%/os/freebsd/sys/mnttab.h \
|
|
%D%/os/freebsd/sys/mount.h \
|
|
%D%/os/freebsd/sys/param.h \
|
|
%D%/os/freebsd/sys/stat.h \
|
|
%D%/os/freebsd/sys/sysmacros.h \
|
|
%D%/os/freebsd/sys/vfs.h \
|
|
%D%/os/freebsd/sys/zfs_context_os.h
|
|
endif
|
|
|
|
|
|
libspl_sys_dktpdir = $(libspl_sysdir)/dktp
|
|
libspl_sys_dktp_HEADERS = \
|
|
%D%/sys/dktp/fdisk.h
|