@papyrus-sdk/engine-native 0.2.22-beta.9.epub.1 → 0.2.22-beta.9.epub.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +0 -1
- package/android/src/main/cpp/CMakeLists.txt +0 -137
- package/android/src/main/java/com/papyrus/engine/PapyrusNativeEngineModule.java +35 -305
- package/android/src/main/java/com/papyrus/engine/PapyrusPackage.java +1 -3
- package/android/src/main/java/com/papyrus/engine/PapyrusPdfViewerView.java +5 -195
- package/android/src/main/java/com/papyrus/engine/PapyrusPdfViewerViewManager.java +1 -20
- package/dist/index.d.mts +4 -614
- package/dist/index.d.ts +4 -614
- package/dist/index.js +8 -484
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -477
- package/dist/index.mjs.map +1 -1
- package/ios/PapyrusEngineStore.h +0 -3
- package/ios/PapyrusEngineStore.m +6 -32
- package/ios/PapyrusNativeEngine.m +5 -684
- package/ios/PapyrusNativeEngine.podspec +15 -0
- package/ios/PapyrusPageView.m +11 -38
- package/package.json +8 -10
- package/react-native.config.js +1 -1
- package/PapyrusNativeEngine.podspec +0 -45
- package/android/src/main/cpp/PapyrusComicArchiveJni.cpp +0 -68
- package/android/src/main/cpp/PapyrusComicArchiveTest.cpp +0 -55
- package/android/src/main/cpp/papyrus_outline_loader_test.cpp +0 -240
- package/android/src/main/cpp/papyrus_text_word_test.cpp +0 -72
- package/android/src/main/java/com/papyrus/engine/PapyrusComicArchiveNative.java +0 -14
- package/android/src/main/java/com/papyrus/engine/PapyrusComicDocumentView.java +0 -491
- package/android/src/main/java/com/papyrus/engine/PapyrusComicDocumentViewManager.java +0 -32
- package/android/src/main/java/com/papyrus/engine/PapyrusComicPageLayout.java +0 -38
- package/android/src/main/java/com/papyrus/engine/PapyrusNativeTextModel.java +0 -195
- package/android/src/main/java/com/papyrus/engine/PapyrusSelectionMenuIcon.java +0 -48
- package/android/src/main/java/com/papyrus/engine/PapyrusTextAnnotationModel.java +0 -22
- package/android/src/main/java/com/papyrus/engine/PapyrusTextDocumentView.java +0 -661
- package/android/src/main/java/com/papyrus/engine/PapyrusTextDocumentViewManager.java +0 -49
- package/android/src/main/java/com/papyrus/engine/PapyrusTextStore.java +0 -43
- package/ios/PapyrusComicDocumentView.h +0 -21
- package/ios/PapyrusComicDocumentView.m +0 -554
- package/ios/PapyrusComicDocumentViewManager.m +0 -23
- package/ios/PapyrusPageRotationRegistry.h +0 -29
- package/ios/PapyrusPageRotationRegistry.m +0 -179
- package/ios/PapyrusPdfDocumentView.h +0 -55
- package/ios/PapyrusPdfDocumentView.m +0 -2339
- package/ios/PapyrusPdfDocumentViewManager.m +0 -61
- package/ios/PapyrusPdfPageTheme.h +0 -15
- package/ios/PapyrusPdfPageTheme.m +0 -218
- package/ios/PapyrusSelectionMenu.h +0 -27
- package/ios/PapyrusTextAnnotationRange.h +0 -2
- package/ios/PapyrusTextAnnotationRange.m +0 -29
- package/ios/PapyrusTextDocumentView.h +0 -32
- package/ios/PapyrusTextDocumentView.m +0 -518
- package/ios/PapyrusTextDocumentViewManager.m +0 -34
- package/ios/PapyrusTextStore.h +0 -13
- package/ios/PapyrusTextStore.m +0 -73
- package/third_party_licenses/BLAKE2-NOTICE.txt +0 -11
- package/third_party_licenses/libarchive-COPYING +0 -65
- package/vendor/libarchive/PapyrusComicArchive.cpp +0 -376
- package/vendor/libarchive/PapyrusComicArchive.h +0 -30
- package/vendor/libarchive/README.papyrus.md +0 -15
- package/vendor/libarchive/android.h +0 -192
- package/vendor/libarchive/config/PapyrusArchiveConfig.h +0 -71
- package/vendor/libarchive/libarchive/CMakeLists.txt +0 -293
- package/vendor/libarchive/libarchive/android_lf.h +0 -36
- package/vendor/libarchive/libarchive/archive.h +0 -1266
- package/vendor/libarchive/libarchive/archive_acl.c +0 -2025
- package/vendor/libarchive/libarchive/archive_acl_private.h +0 -85
- package/vendor/libarchive/libarchive/archive_blake2.h +0 -197
- package/vendor/libarchive/libarchive/archive_blake2_impl.h +0 -161
- package/vendor/libarchive/libarchive/archive_blake2s_ref.c +0 -369
- package/vendor/libarchive/libarchive/archive_blake2sp_ref.c +0 -361
- package/vendor/libarchive/libarchive/archive_check_magic.c +0 -183
- package/vendor/libarchive/libarchive/archive_cmdline.c +0 -211
- package/vendor/libarchive/libarchive/archive_cmdline_private.h +0 -45
- package/vendor/libarchive/libarchive/archive_crc32.h +0 -123
- package/vendor/libarchive/libarchive/archive_cryptor.c +0 -534
- package/vendor/libarchive/libarchive/archive_cryptor_private.h +0 -199
- package/vendor/libarchive/libarchive/archive_digest.c +0 -1584
- package/vendor/libarchive/libarchive/archive_digest_private.h +0 -431
- package/vendor/libarchive/libarchive/archive_disk_acl_darwin.c +0 -558
- package/vendor/libarchive/libarchive/archive_disk_acl_freebsd.c +0 -712
- package/vendor/libarchive/libarchive/archive_disk_acl_linux.c +0 -760
- package/vendor/libarchive/libarchive/archive_disk_acl_sunos.c +0 -824
- package/vendor/libarchive/libarchive/archive_endian.h +0 -234
- package/vendor/libarchive/libarchive/archive_entry.3 +0 -147
- package/vendor/libarchive/libarchive/archive_entry.c +0 -2297
- package/vendor/libarchive/libarchive/archive_entry.h +0 -763
- package/vendor/libarchive/libarchive/archive_entry_acl.3 +0 -458
- package/vendor/libarchive/libarchive/archive_entry_copy_bhfi.c +0 -55
- package/vendor/libarchive/libarchive/archive_entry_copy_stat.c +0 -82
- package/vendor/libarchive/libarchive/archive_entry_link_resolver.c +0 -472
- package/vendor/libarchive/libarchive/archive_entry_linkify.3 +0 -224
- package/vendor/libarchive/libarchive/archive_entry_locale.h +0 -90
- package/vendor/libarchive/libarchive/archive_entry_misc.3 +0 -63
- package/vendor/libarchive/libarchive/archive_entry_paths.3 +0 -153
- package/vendor/libarchive/libarchive/archive_entry_perms.3 +0 -210
- package/vendor/libarchive/libarchive/archive_entry_private.h +0 -205
- package/vendor/libarchive/libarchive/archive_entry_sparse.c +0 -156
- package/vendor/libarchive/libarchive/archive_entry_stat.3 +0 -274
- package/vendor/libarchive/libarchive/archive_entry_stat.c +0 -121
- package/vendor/libarchive/libarchive/archive_entry_strmode.c +0 -69
- package/vendor/libarchive/libarchive/archive_entry_time.3 +0 -127
- package/vendor/libarchive/libarchive/archive_entry_xattr.c +0 -155
- package/vendor/libarchive/libarchive/archive_hmac.c +0 -345
- package/vendor/libarchive/libarchive/archive_hmac_private.h +0 -119
- package/vendor/libarchive/libarchive/archive_integer.h +0 -267
- package/vendor/libarchive/libarchive/archive_match.c +0 -1869
- package/vendor/libarchive/libarchive/archive_openssl_evp_private.h +0 -54
- package/vendor/libarchive/libarchive/archive_openssl_hmac_private.h +0 -54
- package/vendor/libarchive/libarchive/archive_options.c +0 -219
- package/vendor/libarchive/libarchive/archive_options_private.h +0 -49
- package/vendor/libarchive/libarchive/archive_pack_dev.c +0 -330
- package/vendor/libarchive/libarchive/archive_pack_dev.h +0 -49
- package/vendor/libarchive/libarchive/archive_parse_date.c +0 -1173
- package/vendor/libarchive/libarchive/archive_pathmatch.c +0 -480
- package/vendor/libarchive/libarchive/archive_pathmatch.h +0 -50
- package/vendor/libarchive/libarchive/archive_platform.h +0 -213
- package/vendor/libarchive/libarchive/archive_platform_acl.h +0 -53
- package/vendor/libarchive/libarchive/archive_platform_stat.h +0 -45
- package/vendor/libarchive/libarchive/archive_platform_xattr.h +0 -45
- package/vendor/libarchive/libarchive/archive_ppmd7.c +0 -1173
- package/vendor/libarchive/libarchive/archive_ppmd7_private.h +0 -119
- package/vendor/libarchive/libarchive/archive_ppmd8.c +0 -1293
- package/vendor/libarchive/libarchive/archive_ppmd8_private.h +0 -123
- package/vendor/libarchive/libarchive/archive_ppmd_private.h +0 -159
- package/vendor/libarchive/libarchive/archive_private.h +0 -209
- package/vendor/libarchive/libarchive/archive_random.c +0 -274
- package/vendor/libarchive/libarchive/archive_random_private.h +0 -36
- package/vendor/libarchive/libarchive/archive_rb.c +0 -709
- package/vendor/libarchive/libarchive/archive_rb.h +0 -113
- package/vendor/libarchive/libarchive/archive_read.3 +0 -250
- package/vendor/libarchive/libarchive/archive_read.c +0 -1814
- package/vendor/libarchive/libarchive/archive_read_add_passphrase.3 +0 -72
- package/vendor/libarchive/libarchive/archive_read_add_passphrase.c +0 -189
- package/vendor/libarchive/libarchive/archive_read_append_filter.c +0 -209
- package/vendor/libarchive/libarchive/archive_read_data.3 +0 -128
- package/vendor/libarchive/libarchive/archive_read_data_into_fd.c +0 -207
- package/vendor/libarchive/libarchive/archive_read_disk.3 +0 -422
- package/vendor/libarchive/libarchive/archive_read_disk_entry_from_file.c +0 -1086
- package/vendor/libarchive/libarchive/archive_read_disk_posix.c +0 -2639
- package/vendor/libarchive/libarchive/archive_read_disk_private.h +0 -97
- package/vendor/libarchive/libarchive/archive_read_disk_set_standard_lookup.c +0 -315
- package/vendor/libarchive/libarchive/archive_read_disk_windows.c +0 -2603
- package/vendor/libarchive/libarchive/archive_read_extract.3 +0 -135
- package/vendor/libarchive/libarchive/archive_read_extract.c +0 -59
- package/vendor/libarchive/libarchive/archive_read_extract2.c +0 -154
- package/vendor/libarchive/libarchive/archive_read_filter.3 +0 -163
- package/vendor/libarchive/libarchive/archive_read_format.3 +0 -190
- package/vendor/libarchive/libarchive/archive_read_free.3 +0 -91
- package/vendor/libarchive/libarchive/archive_read_header.3 +0 -89
- package/vendor/libarchive/libarchive/archive_read_new.3 +0 -57
- package/vendor/libarchive/libarchive/archive_read_open.3 +0 -247
- package/vendor/libarchive/libarchive/archive_read_open_fd.c +0 -236
- package/vendor/libarchive/libarchive/archive_read_open_file.c +0 -257
- package/vendor/libarchive/libarchive/archive_read_open_filename.c +0 -652
- package/vendor/libarchive/libarchive/archive_read_open_memory.c +0 -188
- package/vendor/libarchive/libarchive/archive_read_private.h +0 -274
- package/vendor/libarchive/libarchive/archive_read_set_format.c +0 -116
- package/vendor/libarchive/libarchive/archive_read_set_options.3 +0 -290
- package/vendor/libarchive/libarchive/archive_read_set_options.c +0 -132
- package/vendor/libarchive/libarchive/archive_read_support_filter_all.c +0 -84
- package/vendor/libarchive/libarchive/archive_read_support_filter_by_code.c +0 -68
- package/vendor/libarchive/libarchive/archive_read_support_filter_bzip2.c +0 -360
- package/vendor/libarchive/libarchive/archive_read_support_filter_compress.c +0 -457
- package/vendor/libarchive/libarchive/archive_read_support_filter_grzip.c +0 -108
- package/vendor/libarchive/libarchive/archive_read_support_filter_gzip.c +0 -538
- package/vendor/libarchive/libarchive/archive_read_support_filter_lrzip.c +0 -119
- package/vendor/libarchive/libarchive/archive_read_support_filter_lz4.c +0 -829
- package/vendor/libarchive/libarchive/archive_read_support_filter_lzop.c +0 -493
- package/vendor/libarchive/libarchive/archive_read_support_filter_none.c +0 -51
- package/vendor/libarchive/libarchive/archive_read_support_filter_program.c +0 -497
- package/vendor/libarchive/libarchive/archive_read_support_filter_rpm.c +0 -249
- package/vendor/libarchive/libarchive/archive_read_support_filter_uu.c +0 -739
- package/vendor/libarchive/libarchive/archive_read_support_filter_xz.c +0 -792
- package/vendor/libarchive/libarchive/archive_read_support_filter_zstd.c +0 -356
- package/vendor/libarchive/libarchive/archive_read_support_format_7zip.c +0 -4650
- package/vendor/libarchive/libarchive/archive_read_support_format_all.c +0 -88
- package/vendor/libarchive/libarchive/archive_read_support_format_ar.c +0 -597
- package/vendor/libarchive/libarchive/archive_read_support_format_by_code.c +0 -76
- package/vendor/libarchive/libarchive/archive_read_support_format_cab.c +0 -3410
- package/vendor/libarchive/libarchive/archive_read_support_format_cpio.c +0 -1152
- package/vendor/libarchive/libarchive/archive_read_support_format_empty.c +0 -95
- package/vendor/libarchive/libarchive/archive_read_support_format_iso9660.c +0 -3516
- package/vendor/libarchive/libarchive/archive_read_support_format_lha.c +0 -2931
- package/vendor/libarchive/libarchive/archive_read_support_format_mtree.c +0 -2113
- package/vendor/libarchive/libarchive/archive_read_support_format_rar.c +0 -3932
- package/vendor/libarchive/libarchive/archive_read_support_format_rar5.c +0 -4501
- package/vendor/libarchive/libarchive/archive_read_support_format_raw.c +0 -194
- package/vendor/libarchive/libarchive/archive_read_support_format_tar.c +0 -3785
- package/vendor/libarchive/libarchive/archive_read_support_format_warc.c +0 -875
- package/vendor/libarchive/libarchive/archive_read_support_format_xar.c +0 -3770
- package/vendor/libarchive/libarchive/archive_read_support_format_zip.c +0 -4710
- package/vendor/libarchive/libarchive/archive_string.c +0 -4391
- package/vendor/libarchive/libarchive/archive_string.h +0 -244
- package/vendor/libarchive/libarchive/archive_string_composition.h +0 -2289
- package/vendor/libarchive/libarchive/archive_string_sprintf.c +0 -200
- package/vendor/libarchive/libarchive/archive_time.c +0 -168
- package/vendor/libarchive/libarchive/archive_time_private.h +0 -47
- package/vendor/libarchive/libarchive/archive_util.3 +0 -239
- package/vendor/libarchive/libarchive/archive_util.c +0 -668
- package/vendor/libarchive/libarchive/archive_version_details.c +0 -516
- package/vendor/libarchive/libarchive/archive_virtual.c +0 -162
- package/vendor/libarchive/libarchive/archive_windows.c +0 -1035
- package/vendor/libarchive/libarchive/archive_windows.h +0 -332
- package/vendor/libarchive/libarchive/archive_write.3 +0 -266
- package/vendor/libarchive/libarchive/archive_write.c +0 -896
- package/vendor/libarchive/libarchive/archive_write_add_filter.c +0 -71
- package/vendor/libarchive/libarchive/archive_write_add_filter_b64encode.c +0 -329
- package/vendor/libarchive/libarchive/archive_write_add_filter_by_name.c +0 -76
- package/vendor/libarchive/libarchive/archive_write_add_filter_bzip2.c +0 -411
- package/vendor/libarchive/libarchive/archive_write_add_filter_compress.c +0 -459
- package/vendor/libarchive/libarchive/archive_write_add_filter_grzip.c +0 -143
- package/vendor/libarchive/libarchive/archive_write_add_filter_gzip.c +0 -493
- package/vendor/libarchive/libarchive/archive_write_add_filter_lrzip.c +0 -214
- package/vendor/libarchive/libarchive/archive_write_add_filter_lz4.c +0 -710
- package/vendor/libarchive/libarchive/archive_write_add_filter_lzop.c +0 -500
- package/vendor/libarchive/libarchive/archive_write_add_filter_none.c +0 -42
- package/vendor/libarchive/libarchive/archive_write_add_filter_program.c +0 -398
- package/vendor/libarchive/libarchive/archive_write_add_filter_uuencode.c +0 -320
- package/vendor/libarchive/libarchive/archive_write_add_filter_xz.c +0 -547
- package/vendor/libarchive/libarchive/archive_write_add_filter_zstd.c +0 -608
- package/vendor/libarchive/libarchive/archive_write_blocksize.3 +0 -112
- package/vendor/libarchive/libarchive/archive_write_data.3 +0 -88
- package/vendor/libarchive/libarchive/archive_write_disk.3 +0 -360
- package/vendor/libarchive/libarchive/archive_write_disk_posix.c +0 -4789
- package/vendor/libarchive/libarchive/archive_write_disk_private.h +0 -43
- package/vendor/libarchive/libarchive/archive_write_disk_set_standard_lookup.c +0 -265
- package/vendor/libarchive/libarchive/archive_write_disk_windows.c +0 -2952
- package/vendor/libarchive/libarchive/archive_write_filter.3 +0 -140
- package/vendor/libarchive/libarchive/archive_write_finish_entry.3 +0 -77
- package/vendor/libarchive/libarchive/archive_write_format.3 +0 -187
- package/vendor/libarchive/libarchive/archive_write_free.3 +0 -94
- package/vendor/libarchive/libarchive/archive_write_header.3 +0 -71
- package/vendor/libarchive/libarchive/archive_write_new.3 +0 -56
- package/vendor/libarchive/libarchive/archive_write_open.3 +0 -270
- package/vendor/libarchive/libarchive/archive_write_open_fd.c +0 -141
- package/vendor/libarchive/libarchive/archive_write_open_file.c +0 -102
- package/vendor/libarchive/libarchive/archive_write_open_filename.c +0 -272
- package/vendor/libarchive/libarchive/archive_write_open_memory.c +0 -110
- package/vendor/libarchive/libarchive/archive_write_private.h +0 -166
- package/vendor/libarchive/libarchive/archive_write_set_format.c +0 -124
- package/vendor/libarchive/libarchive/archive_write_set_format_7zip.c +0 -2571
- package/vendor/libarchive/libarchive/archive_write_set_format_ar.c +0 -540
- package/vendor/libarchive/libarchive/archive_write_set_format_by_name.c +0 -93
- package/vendor/libarchive/libarchive/archive_write_set_format_cpio.c +0 -11
- package/vendor/libarchive/libarchive/archive_write_set_format_cpio_binary.c +0 -618
- package/vendor/libarchive/libarchive/archive_write_set_format_cpio_newc.c +0 -457
- package/vendor/libarchive/libarchive/archive_write_set_format_cpio_odc.c +0 -508
- package/vendor/libarchive/libarchive/archive_write_set_format_filter_by_ext.c +0 -141
- package/vendor/libarchive/libarchive/archive_write_set_format_gnutar.c +0 -790
- package/vendor/libarchive/libarchive/archive_write_set_format_iso9660.c +0 -8216
- package/vendor/libarchive/libarchive/archive_write_set_format_mtree.c +0 -2307
- package/vendor/libarchive/libarchive/archive_write_set_format_pax.c +0 -2249
- package/vendor/libarchive/libarchive/archive_write_set_format_private.h +0 -40
- package/vendor/libarchive/libarchive/archive_write_set_format_raw.c +0 -123
- package/vendor/libarchive/libarchive/archive_write_set_format_shar.c +0 -650
- package/vendor/libarchive/libarchive/archive_write_set_format_ustar.c +0 -768
- package/vendor/libarchive/libarchive/archive_write_set_format_v7tar.c +0 -648
- package/vendor/libarchive/libarchive/archive_write_set_format_warc.c +0 -491
- package/vendor/libarchive/libarchive/archive_write_set_format_xar.c +0 -3799
- package/vendor/libarchive/libarchive/archive_write_set_format_zip.c +0 -2548
- package/vendor/libarchive/libarchive/archive_write_set_options.3 +0 -779
- package/vendor/libarchive/libarchive/archive_write_set_options.c +0 -129
- package/vendor/libarchive/libarchive/archive_write_set_passphrase.3 +0 -72
- package/vendor/libarchive/libarchive/archive_write_set_passphrase.c +0 -95
- package/vendor/libarchive/libarchive/archive_xxhash.h +0 -48
- package/vendor/libarchive/libarchive/config_freebsd.h +0 -275
- package/vendor/libarchive/libarchive/cpio.5 +0 -389
- package/vendor/libarchive/libarchive/filter_fork.h +0 -44
- package/vendor/libarchive/libarchive/filter_fork_posix.c +0 -269
- package/vendor/libarchive/libarchive/filter_fork_windows.c +0 -270
- package/vendor/libarchive/libarchive/libarchive-formats.5 +0 -478
- package/vendor/libarchive/libarchive/libarchive.3 +0 -297
- package/vendor/libarchive/libarchive/libarchive_changes.3 +0 -339
- package/vendor/libarchive/libarchive/libarchive_internals.3 +0 -363
- package/vendor/libarchive/libarchive/module.modulemap +0 -34
- package/vendor/libarchive/libarchive/mtree.5 +0 -323
- package/vendor/libarchive/libarchive/tar.5 +0 -947
- package/vendor/libarchive/libarchive/xxhash.c +0 -531
|
@@ -1,389 +0,0 @@
|
|
|
1
|
-
.\" Copyright (c) 2007 Tim Kientzle
|
|
2
|
-
.\" All rights reserved.
|
|
3
|
-
.\"
|
|
4
|
-
.\" Redistribution and use in source and binary forms, with or without
|
|
5
|
-
.\" modification, are permitted provided that the following conditions
|
|
6
|
-
.\" are met:
|
|
7
|
-
.\" 1. Redistributions of source code must retain the above copyright
|
|
8
|
-
.\" notice, this list of conditions and the following disclaimer.
|
|
9
|
-
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
10
|
-
.\" notice, this list of conditions and the following disclaimer in the
|
|
11
|
-
.\" documentation and/or other materials provided with the distribution.
|
|
12
|
-
.\"
|
|
13
|
-
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
14
|
-
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
15
|
-
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
16
|
-
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
17
|
-
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
18
|
-
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
19
|
-
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
20
|
-
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
21
|
-
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
22
|
-
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
23
|
-
.\" SUCH DAMAGE.
|
|
24
|
-
.\"
|
|
25
|
-
.Dd December 23, 2011
|
|
26
|
-
.Dt CPIO 5
|
|
27
|
-
.Os
|
|
28
|
-
.Sh NAME
|
|
29
|
-
.Nm cpio
|
|
30
|
-
.Nd format of cpio archive files
|
|
31
|
-
.Sh DESCRIPTION
|
|
32
|
-
The
|
|
33
|
-
.Nm
|
|
34
|
-
archive format collects any number of files, directories, and other
|
|
35
|
-
file system objects (symbolic links, device nodes, etc.) into a single
|
|
36
|
-
stream of bytes.
|
|
37
|
-
.Ss General Format
|
|
38
|
-
Each file system object in a
|
|
39
|
-
.Nm
|
|
40
|
-
archive comprises a header record with basic numeric metadata
|
|
41
|
-
followed by the full pathname of the entry and the file data.
|
|
42
|
-
The header record stores a series of integer values that generally
|
|
43
|
-
follow the fields in
|
|
44
|
-
.Va struct stat .
|
|
45
|
-
(See
|
|
46
|
-
.Xr stat 2
|
|
47
|
-
for details.)
|
|
48
|
-
The variants differ primarily in how they store those integers
|
|
49
|
-
(binary, octal, or hexadecimal).
|
|
50
|
-
The header is followed by the pathname of the
|
|
51
|
-
entry (the length of the pathname is stored in the header)
|
|
52
|
-
and any file data.
|
|
53
|
-
The end of the archive is indicated by a special record with
|
|
54
|
-
the pathname
|
|
55
|
-
.Dq TRAILER!!! .
|
|
56
|
-
.Ss PWB format
|
|
57
|
-
The PWB binary
|
|
58
|
-
.Nm
|
|
59
|
-
format is the original format, when cpio was introduced as part of the
|
|
60
|
-
Programmer's Work Bench system, a variant of 6th Edition UNIX. It
|
|
61
|
-
stores numbers as 2-byte and 4-byte binary values.
|
|
62
|
-
Each entry begins with a header in the following format:
|
|
63
|
-
.Pp
|
|
64
|
-
.Bd -literal -offset indent
|
|
65
|
-
struct header_pwb_cpio {
|
|
66
|
-
short h_magic;
|
|
67
|
-
short h_dev;
|
|
68
|
-
short h_ino;
|
|
69
|
-
short h_mode;
|
|
70
|
-
short h_uid;
|
|
71
|
-
short h_gid;
|
|
72
|
-
short h_nlink;
|
|
73
|
-
short h_majmin;
|
|
74
|
-
long h_mtime;
|
|
75
|
-
short h_namesize;
|
|
76
|
-
long h_filesize;
|
|
77
|
-
};
|
|
78
|
-
.Ed
|
|
79
|
-
.Pp
|
|
80
|
-
The
|
|
81
|
-
.Va short
|
|
82
|
-
fields here are 16-bit integer values, while the
|
|
83
|
-
.Va long
|
|
84
|
-
fields are 32 bit integers. Since PWB UNIX, like the 6th Edition UNIX
|
|
85
|
-
it was based on, only ran on PDP-11 computers, they
|
|
86
|
-
are in PDP-endian format, which has little-endian shorts, and
|
|
87
|
-
big-endian longs. That is, the long integer whose hexadecimal
|
|
88
|
-
representation is 0x12345678 would be stored in four successive bytes
|
|
89
|
-
as 0x34, 0x12, 0x78, 0x56.
|
|
90
|
-
The fields are as follows:
|
|
91
|
-
.Bl -tag -width indent
|
|
92
|
-
.It Va h_magic
|
|
93
|
-
The integer value octal 070707.
|
|
94
|
-
.It Va h_dev , Va h_ino
|
|
95
|
-
The device and inode numbers from the disk.
|
|
96
|
-
These are used by programs that read
|
|
97
|
-
.Nm
|
|
98
|
-
archives to determine when two entries refer to the same file.
|
|
99
|
-
Programs that synthesize
|
|
100
|
-
.Nm
|
|
101
|
-
archives should be careful to set these to distinct values for each entry.
|
|
102
|
-
.It Va h_mode
|
|
103
|
-
The mode specifies both the regular permissions and the file type, and
|
|
104
|
-
it also holds a couple of bits that are irrelevant to the cpio format,
|
|
105
|
-
because the field is actually a raw copy of the mode field in the inode
|
|
106
|
-
representing the file. These are the IALLOC flag, which shows that
|
|
107
|
-
the inode entry is in use, and the ILARG flag, which shows that the
|
|
108
|
-
file it represents is large enough to have indirect blocks pointers in
|
|
109
|
-
the inode.
|
|
110
|
-
The mode is decoded as follows:
|
|
111
|
-
.Pp
|
|
112
|
-
.Bl -tag -width "MMMMMMM" -compact
|
|
113
|
-
.It 0100000
|
|
114
|
-
IALLOC flag - irrelevant to cpio.
|
|
115
|
-
.It 0060000
|
|
116
|
-
This masks the file type bits.
|
|
117
|
-
.It 0040000
|
|
118
|
-
File type value for directories.
|
|
119
|
-
.It 0020000
|
|
120
|
-
File type value for character special devices.
|
|
121
|
-
.It 0060000
|
|
122
|
-
File type value for block special devices.
|
|
123
|
-
.It 0010000
|
|
124
|
-
ILARG flag - irrelevant to cpio.
|
|
125
|
-
.It 0004000
|
|
126
|
-
SUID bit.
|
|
127
|
-
.It 0002000
|
|
128
|
-
SGID bit.
|
|
129
|
-
.It 0001000
|
|
130
|
-
Sticky bit.
|
|
131
|
-
.It 0000777
|
|
132
|
-
The lower 9 bits specify read/write/execute permissions
|
|
133
|
-
for world, group, and user following standard POSIX conventions.
|
|
134
|
-
.El
|
|
135
|
-
.It Va h_uid , Va h_gid
|
|
136
|
-
The numeric user id and group id of the owner.
|
|
137
|
-
.It Va h_nlink
|
|
138
|
-
The number of links to this file.
|
|
139
|
-
Directories always have a value of at least two here.
|
|
140
|
-
Note that hardlinked files include file data with every copy in the archive.
|
|
141
|
-
.It Va h_majmin
|
|
142
|
-
For block special and character special entries,
|
|
143
|
-
this field contains the associated device number, with the major
|
|
144
|
-
number in the high byte, and the minor number in the low byte.
|
|
145
|
-
For all other entry types, it should be set to zero by writers
|
|
146
|
-
and ignored by readers.
|
|
147
|
-
.It Va h_mtime
|
|
148
|
-
Modification time of the file, indicated as the number
|
|
149
|
-
of seconds since the start of the epoch,
|
|
150
|
-
00:00:00 UTC January 1, 1970.
|
|
151
|
-
.It Va h_namesize
|
|
152
|
-
The number of bytes in the pathname that follows the header.
|
|
153
|
-
This count includes the trailing NUL byte.
|
|
154
|
-
.It Va h_filesize
|
|
155
|
-
The size of the file. Note that this archive format is limited to 16
|
|
156
|
-
megabyte file sizes, because PWB UNIX, like 6th Edition, only used
|
|
157
|
-
an unsigned 24 bit integer for the file size internally.
|
|
158
|
-
.El
|
|
159
|
-
.Pp
|
|
160
|
-
The pathname immediately follows the fixed header.
|
|
161
|
-
If
|
|
162
|
-
.Cm h_namesize
|
|
163
|
-
is odd, an additional NUL byte is added after the pathname.
|
|
164
|
-
The file data is then appended, again with an additional NUL
|
|
165
|
-
appended if needed to get the next header at an even offset.
|
|
166
|
-
.Pp
|
|
167
|
-
Hardlinked files are not given special treatment;
|
|
168
|
-
the full file contents are included with each copy of the
|
|
169
|
-
file.
|
|
170
|
-
.Ss New Binary Format
|
|
171
|
-
The new binary
|
|
172
|
-
.Nm
|
|
173
|
-
format showed up when cpio was adopted into late 7th Edition UNIX.
|
|
174
|
-
It is exactly like the PWB binary format, described above, except for
|
|
175
|
-
three changes:
|
|
176
|
-
.Pp
|
|
177
|
-
First, UNIX now ran on more than one hardware type, so the endianness
|
|
178
|
-
of 16 bit integers must be determined by observing the magic number at
|
|
179
|
-
the start of the header. The 32 bit integers are still always stored
|
|
180
|
-
with the most significant word first, though, so each of those two, in
|
|
181
|
-
the struct shown above, was stored as an array of two 16 bit integers,
|
|
182
|
-
in the traditional order. Those 16 bit integers, like all the others
|
|
183
|
-
in the struct, were accessed using a macro that byte swapped them if
|
|
184
|
-
necessary.
|
|
185
|
-
.Pp
|
|
186
|
-
Next, 7th Edition had more file types to store, and the IALLOC and ILARG
|
|
187
|
-
flag bits were re-purposed to accommodate these. The revised use of the
|
|
188
|
-
various bits is as follows:
|
|
189
|
-
.Pp
|
|
190
|
-
.Bl -tag -width "MMMMMMM" -compact
|
|
191
|
-
.It 0170000
|
|
192
|
-
This masks the file type bits.
|
|
193
|
-
.It 0140000
|
|
194
|
-
File type value for sockets.
|
|
195
|
-
.It 0120000
|
|
196
|
-
File type value for symbolic links.
|
|
197
|
-
For symbolic links, the link body is stored as file data.
|
|
198
|
-
.It 0100000
|
|
199
|
-
File type value for regular files.
|
|
200
|
-
.It 0060000
|
|
201
|
-
File type value for block special devices.
|
|
202
|
-
.It 0040000
|
|
203
|
-
File type value for directories.
|
|
204
|
-
.It 0020000
|
|
205
|
-
File type value for character special devices.
|
|
206
|
-
.It 0010000
|
|
207
|
-
File type value for named pipes or FIFOs.
|
|
208
|
-
.It 0004000
|
|
209
|
-
SUID bit.
|
|
210
|
-
.It 0002000
|
|
211
|
-
SGID bit.
|
|
212
|
-
.It 0001000
|
|
213
|
-
Sticky bit.
|
|
214
|
-
.It 0000777
|
|
215
|
-
The lower 9 bits specify read/write/execute permissions
|
|
216
|
-
for world, group, and user following standard POSIX conventions.
|
|
217
|
-
.El
|
|
218
|
-
.Pp
|
|
219
|
-
Finally, the file size field now represents a signed 32 bit integer in
|
|
220
|
-
the underlying file system, so the maximum file size has increased to
|
|
221
|
-
2 gigabytes.
|
|
222
|
-
.Pp
|
|
223
|
-
Note that there is no obvious way to tell which of the two binary
|
|
224
|
-
formats an archive uses, other than to see which one makes more
|
|
225
|
-
sense. The typical error scenario is that a PWB format archive
|
|
226
|
-
unpacked as if it were in the new format will create named sockets
|
|
227
|
-
instead of directories, and then fail to unpack files that should
|
|
228
|
-
go in those directories. Running
|
|
229
|
-
.Va bsdcpio -itv
|
|
230
|
-
on an unknown archive will make it obvious which it is: if it's
|
|
231
|
-
PWB format, directories will be listed with an 's' instead of
|
|
232
|
-
a 'd' as the first character of the mode string, and the larger
|
|
233
|
-
files will have a '?' in that position.
|
|
234
|
-
.Ss Portable ASCII Format
|
|
235
|
-
.St -susv2
|
|
236
|
-
standardized an ASCII variant that is portable across all
|
|
237
|
-
platforms.
|
|
238
|
-
It is commonly known as the
|
|
239
|
-
.Dq old character
|
|
240
|
-
format or as the
|
|
241
|
-
.Dq odc
|
|
242
|
-
format.
|
|
243
|
-
It stores the same numeric fields as the old binary format, but
|
|
244
|
-
represents them as 6-character or 11-character octal values.
|
|
245
|
-
.Pp
|
|
246
|
-
.Bd -literal -offset indent
|
|
247
|
-
struct cpio_odc_header {
|
|
248
|
-
char c_magic[6];
|
|
249
|
-
char c_dev[6];
|
|
250
|
-
char c_ino[6];
|
|
251
|
-
char c_mode[6];
|
|
252
|
-
char c_uid[6];
|
|
253
|
-
char c_gid[6];
|
|
254
|
-
char c_nlink[6];
|
|
255
|
-
char c_rdev[6];
|
|
256
|
-
char c_mtime[11];
|
|
257
|
-
char c_namesize[6];
|
|
258
|
-
char c_filesize[11];
|
|
259
|
-
};
|
|
260
|
-
.Ed
|
|
261
|
-
.Pp
|
|
262
|
-
The fields are identical to those in the new binary format.
|
|
263
|
-
The name and file body follow the fixed header.
|
|
264
|
-
Unlike the binary formats, there is no additional padding
|
|
265
|
-
after the pathname or file contents.
|
|
266
|
-
If the files being archived are themselves entirely ASCII, then
|
|
267
|
-
the resulting archive will be entirely ASCII, except for the
|
|
268
|
-
NUL byte that terminates the name field.
|
|
269
|
-
.Ss New ASCII Format
|
|
270
|
-
The "new" ASCII format uses 8-byte hexadecimal fields for
|
|
271
|
-
all numbers and separates device numbers into separate fields
|
|
272
|
-
for major and minor numbers.
|
|
273
|
-
.Pp
|
|
274
|
-
.Bd -literal -offset indent
|
|
275
|
-
struct cpio_newc_header {
|
|
276
|
-
char c_magic[6];
|
|
277
|
-
char c_ino[8];
|
|
278
|
-
char c_mode[8];
|
|
279
|
-
char c_uid[8];
|
|
280
|
-
char c_gid[8];
|
|
281
|
-
char c_nlink[8];
|
|
282
|
-
char c_mtime[8];
|
|
283
|
-
char c_filesize[8];
|
|
284
|
-
char c_devmajor[8];
|
|
285
|
-
char c_devminor[8];
|
|
286
|
-
char c_rdevmajor[8];
|
|
287
|
-
char c_rdevminor[8];
|
|
288
|
-
char c_namesize[8];
|
|
289
|
-
char c_check[8];
|
|
290
|
-
};
|
|
291
|
-
.Ed
|
|
292
|
-
.Pp
|
|
293
|
-
Except as specified below, the fields here match those specified
|
|
294
|
-
for the new binary format above.
|
|
295
|
-
.Bl -tag -width indent
|
|
296
|
-
.It Va magic
|
|
297
|
-
The string
|
|
298
|
-
.Dq 070701 .
|
|
299
|
-
.It Va check
|
|
300
|
-
This field is always set to zero by writers and ignored by readers.
|
|
301
|
-
See the next section for more details.
|
|
302
|
-
.El
|
|
303
|
-
.Pp
|
|
304
|
-
The pathname is followed by NUL bytes so that the total size
|
|
305
|
-
of the fixed header plus pathname is a multiple of four.
|
|
306
|
-
Likewise, the file data is padded to a multiple of four bytes.
|
|
307
|
-
Note that this format supports only 4 gigabyte files (unlike the
|
|
308
|
-
older ASCII format, which supports 8 gigabyte files).
|
|
309
|
-
.Pp
|
|
310
|
-
In this format, hardlinked files are handled by setting the
|
|
311
|
-
filesize to zero for each entry except the first one that
|
|
312
|
-
appears in the archive.
|
|
313
|
-
.Ss New CRC Format
|
|
314
|
-
The CRC format is identical to the new ASCII format described
|
|
315
|
-
in the previous section except that the magic field is set
|
|
316
|
-
to
|
|
317
|
-
.Dq 070702
|
|
318
|
-
and the
|
|
319
|
-
.Va check
|
|
320
|
-
field is set to the sum of all bytes in the file data.
|
|
321
|
-
This sum is computed treating all bytes as unsigned values
|
|
322
|
-
and using unsigned arithmetic.
|
|
323
|
-
Only the least-significant 32 bits of the sum are stored.
|
|
324
|
-
.Ss HP variants
|
|
325
|
-
The
|
|
326
|
-
.Nm cpio
|
|
327
|
-
implementation distributed with HPUX used XXXX but stored
|
|
328
|
-
device numbers differently XXX.
|
|
329
|
-
.Ss Other Extensions and Variants
|
|
330
|
-
Sun Solaris uses additional file types to store extended file
|
|
331
|
-
data, including ACLs and extended attributes, as special
|
|
332
|
-
entries in cpio archives.
|
|
333
|
-
.Pp
|
|
334
|
-
XXX Others? XXX
|
|
335
|
-
.Sh SEE ALSO
|
|
336
|
-
.Xr cpio 1 ,
|
|
337
|
-
.Xr tar 5
|
|
338
|
-
.Sh STANDARDS
|
|
339
|
-
The
|
|
340
|
-
.Nm cpio
|
|
341
|
-
utility is no longer a part of POSIX or the Single Unix Standard.
|
|
342
|
-
It last appeared in
|
|
343
|
-
.St -susv2 .
|
|
344
|
-
It has been supplanted in subsequent standards by
|
|
345
|
-
.Xr pax 1 .
|
|
346
|
-
The portable ASCII format is currently part of the specification for the
|
|
347
|
-
.Xr pax 1
|
|
348
|
-
utility.
|
|
349
|
-
.Sh HISTORY
|
|
350
|
-
The original cpio utility was written by Dick Haight
|
|
351
|
-
while working in AT&T's Unix Support Group.
|
|
352
|
-
It appeared in 1977 as part of PWB/UNIX 1.0, the
|
|
353
|
-
.Dq Programmer's Work Bench
|
|
354
|
-
derived from
|
|
355
|
-
.At v6
|
|
356
|
-
that was used internally at AT&T.
|
|
357
|
-
Both the new binary and old character formats were in use
|
|
358
|
-
by 1980, according to the System III source released
|
|
359
|
-
by SCO under their
|
|
360
|
-
.Dq Ancient Unix
|
|
361
|
-
license.
|
|
362
|
-
The character format was adopted as part of
|
|
363
|
-
.St -p1003.1-88 .
|
|
364
|
-
XXX when did "newc" appear? Who invented it? When did HP come out with their variant? When did Sun introduce ACLs and extended attributes? XXX
|
|
365
|
-
.Sh BUGS
|
|
366
|
-
The
|
|
367
|
-
.Dq CRC
|
|
368
|
-
format is mis-named, as it uses a simple checksum and
|
|
369
|
-
not a cyclic redundancy check.
|
|
370
|
-
.Pp
|
|
371
|
-
The binary formats are limited to 16 bits for user id, group id,
|
|
372
|
-
device, and inode numbers. They are limited to 16 megabyte and 2
|
|
373
|
-
gigabyte file sizes for the older and newer variants, respectively.
|
|
374
|
-
.Pp
|
|
375
|
-
The old ASCII format is limited to 18 bits for
|
|
376
|
-
the user id, group id, device, and inode numbers.
|
|
377
|
-
It is limited to 8 gigabyte file sizes.
|
|
378
|
-
.Pp
|
|
379
|
-
The new ASCII format is limited to 4 gigabyte file sizes.
|
|
380
|
-
.Pp
|
|
381
|
-
None of the cpio formats store user or group names,
|
|
382
|
-
which are essential when moving files between systems with
|
|
383
|
-
dissimilar user or group numbering.
|
|
384
|
-
.Pp
|
|
385
|
-
Especially when writing older cpio variants, it may be necessary
|
|
386
|
-
to map actual device/inode values to synthesized values that
|
|
387
|
-
fit the available fields.
|
|
388
|
-
With very large filesystems, this may be necessary even for
|
|
389
|
-
the newer formats.
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/*-
|
|
2
|
-
* Copyright (c) 2007 Joerg Sonnenberger
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
*
|
|
5
|
-
* Redistribution and use in source and binary forms, with or without
|
|
6
|
-
* modification, are permitted provided that the following conditions
|
|
7
|
-
* are met:
|
|
8
|
-
* 1. Redistributions of source code must retain the above copyright
|
|
9
|
-
* notice, this list of conditions and the following disclaimer.
|
|
10
|
-
* 2. Redistributions in binary form must reproduce the above copyright
|
|
11
|
-
* notice, this list of conditions and the following disclaimer in the
|
|
12
|
-
* documentation and/or other materials provided with the distribution.
|
|
13
|
-
*
|
|
14
|
-
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
|
|
15
|
-
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
16
|
-
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
17
|
-
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
18
|
-
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
19
|
-
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
20
|
-
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
21
|
-
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
22
|
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
23
|
-
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
#ifndef FILTER_FORK_H
|
|
27
|
-
#define FILTER_FORK_H
|
|
28
|
-
|
|
29
|
-
#ifndef __LIBARCHIVE_BUILD
|
|
30
|
-
#error This header is only to be used internally to libarchive.
|
|
31
|
-
#endif
|
|
32
|
-
|
|
33
|
-
int
|
|
34
|
-
__archive_create_child(const char *cmd, int *child_stdin, int *child_stdout,
|
|
35
|
-
#if defined(_WIN32) && !defined(__CYGWIN__)
|
|
36
|
-
HANDLE *out_child);
|
|
37
|
-
#else
|
|
38
|
-
pid_t *out_child);
|
|
39
|
-
#endif
|
|
40
|
-
|
|
41
|
-
void
|
|
42
|
-
__archive_check_child(int in, int out);
|
|
43
|
-
|
|
44
|
-
#endif
|
|
@@ -1,269 +0,0 @@
|
|
|
1
|
-
/*-
|
|
2
|
-
* Copyright (c) 2007 Joerg Sonnenberger
|
|
3
|
-
* Copyright (c) 2012 Michihiro NAKAJIMA
|
|
4
|
-
* All rights reserved.
|
|
5
|
-
*
|
|
6
|
-
* Redistribution and use in source and binary forms, with or without
|
|
7
|
-
* modification, are permitted provided that the following conditions
|
|
8
|
-
* are met:
|
|
9
|
-
* 1. Redistributions of source code must retain the above copyright
|
|
10
|
-
* notice, this list of conditions and the following disclaimer.
|
|
11
|
-
* 2. Redistributions in binary form must reproduce the above copyright
|
|
12
|
-
* notice, this list of conditions and the following disclaimer in the
|
|
13
|
-
* documentation and/or other materials provided with the distribution.
|
|
14
|
-
*
|
|
15
|
-
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
|
|
16
|
-
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
17
|
-
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
18
|
-
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
19
|
-
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
20
|
-
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
21
|
-
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
22
|
-
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
23
|
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
24
|
-
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
#include "archive_platform.h"
|
|
28
|
-
|
|
29
|
-
/* This capability is only available on POSIX systems. */
|
|
30
|
-
#if defined(HAVE_PIPE) && defined(HAVE_FCNTL) && \
|
|
31
|
-
(defined(HAVE_FORK) || defined(HAVE_VFORK) || defined(HAVE_POSIX_SPAWNP))
|
|
32
|
-
|
|
33
|
-
#if defined(HAVE_SYS_TYPES_H)
|
|
34
|
-
# include <sys/types.h>
|
|
35
|
-
#endif
|
|
36
|
-
#ifdef HAVE_ERRNO_H
|
|
37
|
-
# include <errno.h>
|
|
38
|
-
#endif
|
|
39
|
-
#ifdef HAVE_STRING_H
|
|
40
|
-
# include <string.h>
|
|
41
|
-
#endif
|
|
42
|
-
#if defined(HAVE_POLL) && (defined(HAVE_POLL_H) || defined(HAVE_SYS_POLL_H))
|
|
43
|
-
# if defined(HAVE_POLL_H)
|
|
44
|
-
# include <poll.h>
|
|
45
|
-
# elif defined(HAVE_SYS_POLL_H)
|
|
46
|
-
# include <sys/poll.h>
|
|
47
|
-
# endif
|
|
48
|
-
#elif defined(HAVE_SELECT)
|
|
49
|
-
# if defined(HAVE_SYS_SELECT_H)
|
|
50
|
-
# include <sys/select.h>
|
|
51
|
-
# elif defined(HAVE_UNISTD_H)
|
|
52
|
-
# include <unistd.h>
|
|
53
|
-
# endif
|
|
54
|
-
#endif
|
|
55
|
-
#ifdef HAVE_FCNTL_H
|
|
56
|
-
# include <fcntl.h>
|
|
57
|
-
#endif
|
|
58
|
-
#ifdef HAVE_SPAWN_H
|
|
59
|
-
# include <spawn.h>
|
|
60
|
-
#endif
|
|
61
|
-
#ifdef HAVE_STDLIB_H
|
|
62
|
-
# include <stdlib.h>
|
|
63
|
-
#endif
|
|
64
|
-
#ifdef HAVE_UNISTD_H
|
|
65
|
-
# include <unistd.h>
|
|
66
|
-
#endif
|
|
67
|
-
|
|
68
|
-
#include "archive.h"
|
|
69
|
-
#include "archive_cmdline_private.h"
|
|
70
|
-
|
|
71
|
-
#include "filter_fork.h"
|
|
72
|
-
|
|
73
|
-
int
|
|
74
|
-
__archive_create_child(const char *cmd, int *child_stdin, int *child_stdout,
|
|
75
|
-
pid_t *out_child)
|
|
76
|
-
{
|
|
77
|
-
pid_t child = -1;
|
|
78
|
-
int stdin_pipe[2], stdout_pipe[2], tmp;
|
|
79
|
-
|
|
80
|
-
#if !defined(POSIX_SPAWN_CLOEXEC_DEFAULT) && \
|
|
81
|
-
(HAVE_FORK || HAVE_VFORK) && \
|
|
82
|
-
(HAVE_CLOSEFROM || HAVE_CLOSE_RANGE || defined(_SC_OPEN_MAX))
|
|
83
|
-
#undef HAVE_POSIX_SPAWNP
|
|
84
|
-
#endif
|
|
85
|
-
|
|
86
|
-
#if HAVE_POSIX_SPAWNP
|
|
87
|
-
posix_spawnattr_t attr;
|
|
88
|
-
posix_spawn_file_actions_t actions;
|
|
89
|
-
int r;
|
|
90
|
-
#endif
|
|
91
|
-
struct archive_cmdline *cmdline;
|
|
92
|
-
|
|
93
|
-
cmdline = __archive_cmdline_allocate();
|
|
94
|
-
if (cmdline == NULL)
|
|
95
|
-
goto state_allocated;
|
|
96
|
-
if (__archive_cmdline_parse(cmdline, cmd) != ARCHIVE_OK)
|
|
97
|
-
goto state_allocated;
|
|
98
|
-
|
|
99
|
-
if (pipe(stdin_pipe) == -1)
|
|
100
|
-
goto state_allocated;
|
|
101
|
-
if (stdin_pipe[0] == 1 /* stdout */) {
|
|
102
|
-
if ((tmp = dup(stdin_pipe[0])) == -1)
|
|
103
|
-
goto stdin_opened;
|
|
104
|
-
close(stdin_pipe[0]);
|
|
105
|
-
stdin_pipe[0] = tmp;
|
|
106
|
-
}
|
|
107
|
-
if (pipe(stdout_pipe) == -1)
|
|
108
|
-
goto stdin_opened;
|
|
109
|
-
if (stdout_pipe[1] == 0 /* stdin */) {
|
|
110
|
-
if ((tmp = dup(stdout_pipe[1])) == -1)
|
|
111
|
-
goto stdout_opened;
|
|
112
|
-
close(stdout_pipe[1]);
|
|
113
|
-
stdout_pipe[1] = tmp;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
#if HAVE_POSIX_SPAWNP
|
|
117
|
-
|
|
118
|
-
r = posix_spawnattr_init(&attr);
|
|
119
|
-
if (r != 0) {
|
|
120
|
-
errno = r;
|
|
121
|
-
goto stdout_opened;
|
|
122
|
-
}
|
|
123
|
-
r = posix_spawn_file_actions_init(&actions);
|
|
124
|
-
if (r != 0) {
|
|
125
|
-
errno = r;
|
|
126
|
-
goto attr_inited;
|
|
127
|
-
}
|
|
128
|
-
#ifdef POSIX_SPAWN_CLOEXEC_DEFAULT
|
|
129
|
-
r = posix_spawnattr_setflags(&attr, POSIX_SPAWN_CLOEXEC_DEFAULT);
|
|
130
|
-
if (r != 0)
|
|
131
|
-
goto actions_inited;
|
|
132
|
-
#endif
|
|
133
|
-
r = posix_spawn_file_actions_addclose(&actions, stdin_pipe[1]);
|
|
134
|
-
if (r != 0)
|
|
135
|
-
goto actions_inited;
|
|
136
|
-
r = posix_spawn_file_actions_addclose(&actions, stdout_pipe[0]);
|
|
137
|
-
if (r != 0)
|
|
138
|
-
goto actions_inited;
|
|
139
|
-
/* Setup for stdin. */
|
|
140
|
-
r = posix_spawn_file_actions_adddup2(&actions, stdin_pipe[0], 0);
|
|
141
|
-
if (r != 0)
|
|
142
|
-
goto actions_inited;
|
|
143
|
-
if (stdin_pipe[0] != 0 /* stdin */) {
|
|
144
|
-
r = posix_spawn_file_actions_addclose(&actions, stdin_pipe[0]);
|
|
145
|
-
if (r != 0)
|
|
146
|
-
goto actions_inited;
|
|
147
|
-
}
|
|
148
|
-
/* Setup for stdout. */
|
|
149
|
-
r = posix_spawn_file_actions_adddup2(&actions, stdout_pipe[1], 1);
|
|
150
|
-
if (r != 0)
|
|
151
|
-
goto actions_inited;
|
|
152
|
-
if (stdout_pipe[1] != 1 /* stdout */) {
|
|
153
|
-
r = posix_spawn_file_actions_addclose(&actions, stdout_pipe[1]);
|
|
154
|
-
if (r != 0)
|
|
155
|
-
goto actions_inited;
|
|
156
|
-
}
|
|
157
|
-
r = posix_spawnp(&child, cmdline->path, &actions, &attr,
|
|
158
|
-
cmdline->argv, NULL);
|
|
159
|
-
if (r != 0)
|
|
160
|
-
goto actions_inited;
|
|
161
|
-
posix_spawn_file_actions_destroy(&actions);
|
|
162
|
-
posix_spawnattr_destroy(&attr);
|
|
163
|
-
|
|
164
|
-
#else /* HAVE_POSIX_SPAWNP */
|
|
165
|
-
|
|
166
|
-
#if HAVE_VFORK
|
|
167
|
-
child = vfork();
|
|
168
|
-
#else
|
|
169
|
-
child = fork();
|
|
170
|
-
#endif
|
|
171
|
-
if (child == -1)
|
|
172
|
-
goto stdout_opened;
|
|
173
|
-
if (child == 0) {
|
|
174
|
-
close(stdin_pipe[1]);
|
|
175
|
-
close(stdout_pipe[0]);
|
|
176
|
-
if (dup2(stdin_pipe[0], 0 /* stdin */) == -1)
|
|
177
|
-
_exit(254);
|
|
178
|
-
if (stdin_pipe[0] != 0 /* stdin */)
|
|
179
|
-
close(stdin_pipe[0]);
|
|
180
|
-
if (dup2(stdout_pipe[1], 1 /* stdout */) == -1)
|
|
181
|
-
_exit(254);
|
|
182
|
-
if (stdout_pipe[1] != 1 /* stdout */)
|
|
183
|
-
close(stdout_pipe[1]);
|
|
184
|
-
|
|
185
|
-
#if HAVE_CLOSEFROM
|
|
186
|
-
closefrom(3);
|
|
187
|
-
#elif HAVE_CLOSE_RANGE
|
|
188
|
-
close_range(3, ~0U, 0);
|
|
189
|
-
#elif defined(_SC_OPEN_MAX)
|
|
190
|
-
for (int i = sysconf(_SC_OPEN_MAX); i > 3;)
|
|
191
|
-
close(--i);
|
|
192
|
-
#endif
|
|
193
|
-
|
|
194
|
-
execvp(cmdline->path, cmdline->argv);
|
|
195
|
-
_exit(254);
|
|
196
|
-
}
|
|
197
|
-
#endif /* HAVE_POSIX_SPAWNP */
|
|
198
|
-
|
|
199
|
-
close(stdin_pipe[0]);
|
|
200
|
-
close(stdout_pipe[1]);
|
|
201
|
-
|
|
202
|
-
*child_stdin = stdin_pipe[1];
|
|
203
|
-
fcntl(*child_stdin, F_SETFL, O_NONBLOCK);
|
|
204
|
-
*child_stdout = stdout_pipe[0];
|
|
205
|
-
fcntl(*child_stdout, F_SETFL, O_NONBLOCK);
|
|
206
|
-
__archive_cmdline_free(cmdline);
|
|
207
|
-
|
|
208
|
-
*out_child = child;
|
|
209
|
-
return ARCHIVE_OK;
|
|
210
|
-
|
|
211
|
-
#if HAVE_POSIX_SPAWNP
|
|
212
|
-
actions_inited:
|
|
213
|
-
errno = r;
|
|
214
|
-
posix_spawn_file_actions_destroy(&actions);
|
|
215
|
-
attr_inited:
|
|
216
|
-
posix_spawnattr_destroy(&attr);
|
|
217
|
-
#endif
|
|
218
|
-
stdout_opened:
|
|
219
|
-
close(stdout_pipe[0]);
|
|
220
|
-
close(stdout_pipe[1]);
|
|
221
|
-
stdin_opened:
|
|
222
|
-
close(stdin_pipe[0]);
|
|
223
|
-
close(stdin_pipe[1]);
|
|
224
|
-
state_allocated:
|
|
225
|
-
__archive_cmdline_free(cmdline);
|
|
226
|
-
return ARCHIVE_FAILED;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
void
|
|
230
|
-
__archive_check_child(int in, int out)
|
|
231
|
-
{
|
|
232
|
-
#if defined(HAVE_POLL) && (defined(HAVE_POLL_H) || defined(HAVE_SYS_POLL_H))
|
|
233
|
-
struct pollfd fds[2];
|
|
234
|
-
int idx;
|
|
235
|
-
|
|
236
|
-
idx = 0;
|
|
237
|
-
if (in != -1) {
|
|
238
|
-
fds[idx].fd = in;
|
|
239
|
-
fds[idx].events = POLLOUT;
|
|
240
|
-
++idx;
|
|
241
|
-
}
|
|
242
|
-
if (out != -1) {
|
|
243
|
-
fds[idx].fd = out;
|
|
244
|
-
fds[idx].events = POLLIN;
|
|
245
|
-
++idx;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
poll(fds, idx, -1); /* -1 == INFTIM, wait forever */
|
|
249
|
-
#elif defined(HAVE_SELECT)
|
|
250
|
-
fd_set fds_in, fds_out, fds_error;
|
|
251
|
-
|
|
252
|
-
FD_ZERO(&fds_in);
|
|
253
|
-
FD_ZERO(&fds_out);
|
|
254
|
-
FD_ZERO(&fds_error);
|
|
255
|
-
if (out != -1) {
|
|
256
|
-
FD_SET(out, &fds_in);
|
|
257
|
-
FD_SET(out, &fds_error);
|
|
258
|
-
}
|
|
259
|
-
if (in != -1) {
|
|
260
|
-
FD_SET(in, &fds_out);
|
|
261
|
-
FD_SET(in, &fds_error);
|
|
262
|
-
}
|
|
263
|
-
select(in < out ? out + 1 : in + 1, &fds_in, &fds_out, &fds_error, NULL);
|
|
264
|
-
#else
|
|
265
|
-
sleep(1);
|
|
266
|
-
#endif
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
#endif /* defined(HAVE_PIPE) && defined(HAVE_VFORK) && defined(HAVE_FCNTL) */
|