sys-apps/systemd: update patchset
This commit is contained in:
parent
63aaf72291
commit
a40231a0f6
|
@ -1,33 +1,9 @@
|
|||
AUX 0001-Allow-building-on-musl-libc.patch 99748 BLAKE2B f3556996debaf72d38873e444187dd3fe431a9dfad0a22a500f90c02d087ab170d4b0eee36cd34fd45b5caa44d7bf5c434ee9dfa527f4391cfbd41ee8ddc0399 SHA512 5b3b3d165c293d54f96c4566b1bf30d29a743499c7bdbc82db581e6b613a56895d32dedc47db4c1f5eb13bc98749d33e0e050c9cb735804b43abcb28feb04511
|
||||
AUX gentoo-generator-path-r2.patch 994 BLAKE2B 2bfb42623221291030fa9f7310e9bf747351a26f6ffd842628298787b74d4ec562bacaa9fc5365f7e854f695dab5f74bc06883fefc1f210dce4fd415926817ac SHA512 98054222ea232e120625573b6a532c312eccc02fe657152610b7d056b964bb2165fffae9d17fd986cf547af885d44c26b117fe68df5b24e2607d37f3729d0ada
|
||||
AUX gentoo-journald-audit.patch 1485 BLAKE2B 9cba28ce907330bbc1eafcf04a837987ed68272fcfa9cc34a309ff5d4cc2230f71a6f7fed42c79afb1c96605df141e8e40b2d8290d12ad3c18038269814f2df8 SHA512 d77d4dae9f8a7819c6d4855476f3163ee19f52b20f66a93e25818f0747404462c47e3cafbd82ba85ce1b3d2fdbabdd96a0398b71149b318c540d82403f8ad0ad
|
||||
AUX gentoo-pam.patch 974 BLAKE2B 48e292bd37a32709e459c41b04fdf8dc0e51962cb72896b4bdcdf4a8a9dd87031abce6bec2a6ed1578520f61a014de2c0127a5f96e8feec11b120e7e91b09c89 SHA512 69e50d1cec1e2d927365a97aebffe1024f600a8e5779e214fdc6fa35499786382375edb645d4c8c7c1745b96cd1e5cf83b4b9fc4daffdc1977bf7c7a50891db0
|
||||
AUX gentoo-systemctl-disable-sysv-sync-r1.patch 821 BLAKE2B f5ef796725e023bb1ed83b34a3e4d45bb008de9a134892a5321b37b56809c7a44530d18e33c7877177e8b64b2d89dfc2de844bed433db6d5e57831d20fbfb456 SHA512 8d697dbd305f6b95a4ddc47cf9d99a0e954f54e161bd59164917b62a78ff5c23fa2d5be2614569c0a2297595dae59e1ee71bb04da72cbe0c0807e1abd7da974d
|
||||
AUX musl/0002-don-t-use-glibc-specific-qsort_r.patch 6933 BLAKE2B e3c0b4aa79040c27ba4ec505e60c850988f09fcb6aff7ea91d72565991312261762a3bbb98a0fc97218163d10794443a49e40cfb9b96207c2488db607803bfc8 SHA512 1bdd3d0cb520c56f675d973ad4c55d168dd877eaf618fe9053f40de24784eb30629a870ea6db805f7e1bdc9b27245159d056e9b099c10a72f6be76f2c8ddfbe8
|
||||
AUX musl/0003-implment-systemd-sysv-install-for-OE.patch 1500 BLAKE2B 3e0f44ff529864b0b62dc61f2acd9a04d33e422ed1f98d136ea425fade9dddd7a75d0298db5ab8cda99884ad2f38b85ddd1d85ccd5a402a7bcd7741767a80876 SHA512 7afb2f868e032f65238ae3a2db34acb7c4213f511db2cf99ef0a3e6fcdbdf6d96e94dde4a7de940bdcabec1db6125dc7187f3f95f081f0812ef9dd67eb036d4e
|
||||
AUX musl/0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch 2303 BLAKE2B 0454a0704aa03bfbc6e1dd6e1b0d6e18da90890d2c07c36084a95dff2aef891c2f03f7a401d3a43225e4e6d47d806c2acc60a4b4b34da5ceb7fbbc5e832fa39b SHA512 92d9404276384408f829940e758c399f4b7ae74c1fcad73655a3a0b620cc59982f0a3eef29431dac553154864568b0cdd4dca03a6843f84a3ad1444410e5e22a
|
||||
AUX musl/0004-add-fallback-parse_printf_format-implementation.patch 14076 BLAKE2B 60b1fb6370c0c76643f828dc7b6955349392f19d1734241b277066c97dabcea8c2a4c526084536c97410e239c28d32bd49533745283bf2563556f9f9f587085c SHA512 0d7899ca2de3f1af8e98d7e558cc445163a365ca90615715d3f8977a9d59fcce3374864be1e0536d3f236980c2444a898f29730355e2db97bc401dbe0eda18d4
|
||||
AUX musl/0005-src-basic-missing.h-check-for-missing-strndupa.patch 17572 BLAKE2B 720abd8e9928060b94821723cb3a28f4f8cb971e543abab56d8cf0bb359fefceefcd7f24630ae962a358cd5321889945aaed4097e2918be81b145aa85092218c SHA512 d3c98ec44f098b500478c3dc2944ef46ddc8ab37cac69c29fec71b892f3e975c925d3200b59bd01278cf6a98fe6aa32804e503034405f31ef60dbe5a2d6173d1
|
||||
AUX musl/0006-Include-netinet-if_ether.h.patch 10537 BLAKE2B bb92fded964e4c8183c219259ded0e64d9118d7142d6d2f46dff4922e9c7d2199300a5524ea772c94dbc3001a9dc54b24c8fb67beb3c14bddd04bdc1020d41df SHA512 95f4c9fab8b0e675249877628e8718dfa1a9bac77782c6bc05dca37bb5e28be0479e5f82d5a4ad77a692cfeb247d0dc2a9017b62415024efe1656da3db72abc9
|
||||
AUX musl/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch 4748 BLAKE2B 4b0768cdd4686ca00bfd6290eec54acfaa85b86cb44d43078be54d9756d78ab23973805cf360adc80bbb16e95ffe9e7493811d9b737c944df6ed8c064baa6ec8 SHA512 aa8c724338a876962160417817bc0d4117a3a70397a86fae0ddeea964dbe57cd51f0b27697e9d1ae9baf8c6696e2775ac9e8ab5c2aa8fa186cc765438095e705
|
||||
AUX musl/0008-add-missing-FTW_-macros-for-musl.patch 1124 BLAKE2B f83824c8fac0cdef9bb55961fbadf0cbcbb2a998abf6a880ae9d4a700dcfdba02d63ce2e13b9b2d2b94e702e1f2be2ec456099085b5b7f4f3f5d8afbfadfde4b SHA512 603e64921677883625e398bb769157620b3758da4ed56cadc820b224f15e47cc32c0b7b81ba908035ff8b2cf7e6801aad3e798df66d2f0c53a97d85f62d8a70a
|
||||
AUX musl/0009-fix-missing-of-__register_atfork-for-non-glibc-build.patch 1460 BLAKE2B f144e9bbea36b31f797435702be4ea3a028014c12afc35d1f4cf414fdd5776060c2d80f5b1e6728d7ad76fbed93a895414c33e51d0373f8736d3e6734cb4b80d SHA512 b42ed4d207a43eef136c6acf05ad37d2b7378969d5782e398d8c133dc5463f97431b3fe3f9ac911852051a914a044d641b38657cd89da9d0696b1e12b251152d
|
||||
AUX musl/0010-Use-uintmax_t-for-handling-rlim_t.patch 4836 BLAKE2B 458de13d2ceac38734636a1300011dec13123969be13a2c0228590cd62ad58a3c230e0b82c44eb4bc3bb1255c29b1e02b3af721f6647c865a7c6c5689090ab25 SHA512 6b9f9466a7a60eb152f8a94a1be1fc5ed4a930320ea1f97251f84cfadf779b990e2bcdb2ae42b8c8f663c5a000bb5a8d4b631415961c22f3afd2ab4821612459
|
||||
AUX musl/0011-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch 1079 BLAKE2B 5aa3c24733dea8b1b4697a296335461a8122b877b4db90263d3d3c2928323636d78e4c8913b90156b67fc95d8032373157bd933a7c1c948ae3beb4f29ba3ad24 SHA512 84167fdc88ea4d7567d4878f0546ee7659a43baae839b4ea06a1d19982cd783c32882023b8b2eb862f66346f2379b6a537f836ec9b14544faad68271bc09e059
|
||||
AUX musl/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch 4818 BLAKE2B f162adae44cb1ac3765fe47dfd7d83609643dee0cff45993c3923b4889fb2b1a41f4a62b58afcae06ba7def50881d446385104132e381a748574e6f910e70df5 SHA512 9dbb171a4e4828da28224045e3613cce985b4051f76b5f58a4473ee54100f927edc0e1b06d95adf802e982b86847dd1a9adec0b8bb7cde19b203d0b5a1079b6d
|
||||
AUX musl/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch 956 BLAKE2B bdf32c5287cbc3e4d8a1f1ae619d70045c004e3699214d49a4ec14c331e54c027a9f09d4df8e10a2a850469c1724007ff3582646af03e33ca03021382fb7e00c SHA512 4c80e443ad7e5d37a7a4c33f8c5b63bcf3815db1c3992055a8d77626a5babb8a8ef2ec426e95771629a775b997669b3bec507f819f26ce391620406fc907aca9
|
||||
AUX musl/0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch 1399 BLAKE2B e357a5931df199e54c8219d2dd42bd8cb09649ffe6ecdb1824c8c14e8e898efb5fcead933ceb5709940986ad2d2f02b6c3310e8a77bd7b71375f38db79130ee4 SHA512 50ab9656660565b88f868be14354b4efff4825d9dc40eedc1d4cdd6c681cdb0ab330ed518635742cf307283d43e226b98425cf5afc0810f53936265afa7db721
|
||||
AUX musl/0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch 2213 BLAKE2B 30274b0cafea279d54ad27b14595fe32790070d16ec33f34fc5bf980a6dc7d8eb304a3e4c023da0f315bf02f06265312175b1b140adc0268be332275f82a20da SHA512 586dcac5d327b61d8c8ba4895524c5d9846b2ad8ff5546c1c99af0c378b6d71f6df25bddd29705f88a13fd6496bb8d4c89b06a59e1c881a3154f3b03b5705b91
|
||||
AUX musl/0016-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch 1324 BLAKE2B 85d965e427d3274b0616669868a73ee627953f045f56413ed1d0febbc8a42bdbec5955a1b995fe2cb0285980eeca6460e9dc9ae4834fc7d64b890b14f46c0192 SHA512 d492b6d0d09fa740eae27f2a1e211fca66ca0ae5443405f6a76ebaf9ee9afe8829aed5cf106adf9f6f3ac89f589d4e205162569744027562227fac98c595ba10
|
||||
AUX musl/0017-missing_type.h-add-__compar_d_fn_t-definition.patch 877 BLAKE2B c5c76d950fef898d67d012b3f80829bf723932b973e9a11473b8688df636814f710c5404587e8a6d0a85667397bae86595a838ef4ad43bc86febb5359ce4668b SHA512 476b7ef7731808511666f579740b54d513f2b3cfd6d62b611aa5bcbe05c2ea9ab44d28a3a1bf43bf06aaf93d10431e552f8e8984a7f381d9c875fc0313ac95cb
|
||||
AUX musl/0018-avoid-redefinition-of-prctl_mm_map-structure.patch 840 BLAKE2B 5875a8bb65d6daefb51a849662c8101782d6a83491a535eee61a12b0f2d64f54d852137de909dc72bf2eb8b0fc420d7108be50601431a713420838e6201db894 SHA512 ad98e77b9d38a5f0f064a2a399a6ecac57478462a53b5aff192101c40dfa8ca7ee9be1ff134df64f0da432c02eda08209057237fe8bfe1d169ca1fc7b037b458
|
||||
AUX musl/0019-Handle-missing-LOCK_EX.patch 678 BLAKE2B 9a9adb62ed2256675daaa18ace37d42e0a85db472cc057580b20a42c92cb47baba19e136d725ac1894040f68b3a083359b71cd3e6c8c5df3519b2cb0014155be SHA512 e8c7adc8c4167ab2165d28ca9d421b2da421f48d970249448a9c0b6a27a3dc2e087c96bf335a57a6903a615de372d269f45c98e5abc1029c12971f072a3b6ece
|
||||
AUX musl/0020-Fix-incompatible-pointer-type-struct-sockaddr_un.patch 2064 BLAKE2B c75d798ef873097f07fb34b6fbba07f494dd4fceaf797412935cab09f0b382a16477d0fd74153331361c5fb34d3e169d8a69cf16b25683aedbb9be9057a91585 SHA512 81d0db27dd6982f4a140c034c5c099bc5780b8f06672f5d45491701a5b2150dbbacce86197dcb2056cdbe209c98c97ad54567921df4a9fe9bd975f013213b447
|
||||
AUX musl/0021-test-json.c-define-M_PIl.patch 907 BLAKE2B 68cac8ebee324e84d2ffbec018824904aa3319b6f8fe700aded1532944e63f18d786f18f84e56520517436b17ff2c02bc21058068be7761db9d4039a1bb2c008 SHA512 68582bd212b46a39f37de1f5208993c76a56498142c8519898e82f8cc93d41117748c1d8bcac44563c6e38ff53c49990e95f8ace7bfba5e1b017a34e0469dc7b
|
||||
AUX musl/0022-do-not-disable-buffer-in-writing-files.patch 17981 BLAKE2B 88d0253c9d342d094c698574f3301c982813dfbccf252b6655979d10f3636d4d26db81e89adff64b3b43ebc8131cb0e89fbae359d591b3a8cca682a02ea5c310 SHA512 a8c9c427bcdc0458e19b912ace35660ad50fbcf292f9f60518b49a6b84a5a8dffef37acf7a428ddd9dfdf0bf738fd9ad7afef64369b6477b0b3a0f5416a9cda6
|
||||
AUX musl/0025-Handle-__cpu_mask-usage.patch 1966 BLAKE2B 58ef76ff98fc9b9fb41f5480548aa24fbb1b80a46ba51c4d1cea93d8bd66653a5dd6d396cff2ff5aeeffd63e2d46a319424fc2e63434c22e2df8129f27c181c7 SHA512 0f2360dce835711238ef8e8526f0ed4d9b219c9de86a0290731f78f6f2cffefd38439ca9b747dde10d759c28f8c1c3fb2e4b567736ef8e3397cdcd72c86d2e4b
|
||||
AUX musl/0026-Handle-missing-gshadow.patch 5437 BLAKE2B f2706d6a3f7ccebb3bead4cba82ac3798028d8d7f7192b8fa71a1fce835be7320df5b97f60bfb7a6d73cec56b8b26222bd3e0a183e4b387dea4d854f5103aa2b SHA512 37ecbde34b0fde1dcd7f271904657ad8924c566098c32182646867ad995dcf977ed0ec3f7c71a731c23b4fa2888827fa64aa8311d460605b4a4d725f0147fc58
|
||||
AUX musl/0028-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch 986 BLAKE2B 2c3cfe939e19ce544976920a27be986d33b6fa72a303faa1378ffcab87dffb697fc6816f15101eedfec642ff3ac3b8f155bcb16caee734cab817dfef6c7b1ec2 SHA512 19097ebd33bc9cc966ea54aed119ff30c844130cc64b4369e0571f8a78d15630a2e523fa1a51a56f7fb88ec5850fe18e65eb925fdd8e365d816a1dbc471a6886
|
||||
AUX nsswitch.conf 734 BLAKE2B 5f5a7821a84f6c8aa31fe9a68c29a1a0f24be578d427a623f14a9ef795e7da481f226efe5511d92932b5edf5638fa719808a0c3a0b8fd340799dd6bcb703a0a1 SHA512 dcbd51dacaaebdff32edb3840cc7b9b47b6521009b8786690e3673a2e78bc60bfd8e591b1048c5d452117c6659b9917ae2864462f5057cc39b704b0130522e60
|
||||
DIST systemd-stable-248.3.tar.gz 10320940 BLAKE2B 725494e0197dd182de55e4967088f4b4b709e6b2242723368b6cd95606582e01a57322b1f18fa194149055140a90993696734ad3c004843bfaceb72cd04a3a84 SHA512 8e7ff0d5e63cc933e4dc23f7e0bef9707fde90396605eb8822d34de90d7abe8fd37e5739e33b657868218aa7281147cc944c096c007324c3e6fb54d833a83485
|
||||
EBUILD systemd-248.3.ebuild 17541 BLAKE2B acd093a6656dea62a2dd53b6f5517096cf2197bbd087783c0c4d6bacb21202f2d53e9f744cd4eabb72f8772e62c5d783122172e7c485ecc4d32338bd58611ea4 SHA512 3b2ca7f09a5c53c5044d77e9a0193cd664b8f637449361ecdeeaa2e72f9c3003f7fd343f05e969afdd634a62ab603abbd81675f9ad141afad85a58bec5a91ec9
|
||||
EBUILD systemd-248.3.ebuild 15752 BLAKE2B c0674a7d82c5268279bf99d58c7aa05f91c63a5bdfbc33536dbf53a898e2327aaeb95439684c8dd223f41bd5fc3db64996e107d50e4166a103f2514379118e28 SHA512 37ea1046883a5651cfc9ef47c77e02bb5310cde9bb34937d94ba62c432a4a4e0416aaacb297b922b9f1a32f7de17f23e569456c0cf9cb7af293a535998375188
|
||||
MISC metadata.xml 2373 BLAKE2B fac7a9db4c217998f84bcbb5bc490eee748a35f9d991962d5aa21c6ec562d494af06b67fe35879ee2b245445d22ea7eadc4db6305215f393c4565b86665b3130 SHA512 e2d999684255f6c6509af7dca1b9e1411eac9a4cde6f30d9631c5b9d2bbe749a40f3d08c067d2cad5eb1cdd8ad823c3afb6844cc5e3c1d455fbd8cd20d87a696
|
||||
|
|
|
@ -1,163 +0,0 @@
|
|||
From 159c53612444ec1df492bae528a5a88a275b93bf Mon Sep 17 00:00:00 2001
|
||||
From: Chen Qi <Qi.Chen@windriver.com>
|
||||
Date: Mon, 25 Feb 2019 13:41:41 +0800
|
||||
Subject: [PATCH] don't use glibc-specific qsort_r
|
||||
|
||||
Upstream-Status: Inappropriate [musl specific]
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
[Rebased for v241]
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
[Rebased for v242]
|
||||
Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
|
||||
[Rebased for v247]
|
||||
Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
|
||||
|
||||
---
|
||||
src/basic/sort-util.h | 14 ------------
|
||||
src/libsystemd/sd-hwdb/hwdb-util.c | 19 +++++++++++-----
|
||||
src/shared/format-table.c | 36 ++++++++++++++++++++----------
|
||||
3 files changed, 38 insertions(+), 31 deletions(-)
|
||||
|
||||
diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
|
||||
index 49586a4a24..d92a5ab0ed 100644
|
||||
--- a/src/basic/sort-util.h
|
||||
+++ b/src/basic/sort-util.h
|
||||
@@ -55,18 +55,4 @@ static inline void _qsort_safe(void *base, size_t nmemb, size_t size, __compar_f
|
||||
_qsort_safe((p), (n), sizeof((p)[0]), (__compar_fn_t) _func_); \
|
||||
})
|
||||
|
||||
-static inline void qsort_r_safe(void *base, size_t nmemb, size_t size, __compar_d_fn_t compar, void *userdata) {
|
||||
- if (nmemb <= 1)
|
||||
- return;
|
||||
-
|
||||
- assert(base);
|
||||
- qsort_r(base, nmemb, size, compar, userdata);
|
||||
-}
|
||||
-
|
||||
-#define typesafe_qsort_r(p, n, func, userdata) \
|
||||
- ({ \
|
||||
- int (*_func_)(const typeof(p[0])*, const typeof(p[0])*, typeof(userdata)) = func; \
|
||||
- qsort_r_safe((p), (n), sizeof((p)[0]), (__compar_d_fn_t) _func_, userdata); \
|
||||
- })
|
||||
-
|
||||
int cmp_int(const int *a, const int *b);
|
||||
diff --git a/src/libsystemd/sd-hwdb/hwdb-util.c b/src/libsystemd/sd-hwdb/hwdb-util.c
|
||||
index fd45ff0f54..ac4b63c49b 100644
|
||||
--- a/src/libsystemd/sd-hwdb/hwdb-util.c
|
||||
+++ b/src/libsystemd/sd-hwdb/hwdb-util.c
|
||||
@@ -126,9 +126,13 @@ static struct trie* trie_free(struct trie *trie) {
|
||||
|
||||
DEFINE_TRIVIAL_CLEANUP_FUNC(struct trie*, trie_free);
|
||||
|
||||
-static int trie_values_cmp(const struct trie_value_entry *a, const struct trie_value_entry *b, struct trie *trie) {
|
||||
- return strcmp(trie->strings->buf + a->key_off,
|
||||
- trie->strings->buf + b->key_off);
|
||||
+static struct trie *trie_node_add_value_trie;
|
||||
+static int trie_values_cmp(const void *v1, const void *v2) {
|
||||
+ const struct trie_value_entry *a = v1;
|
||||
+ const struct trie_value_entry *b = v2;
|
||||
+
|
||||
+ return strcmp(trie_node_add_value_trie->strings->buf + a->key_off,
|
||||
+ trie_node_add_value_trie->strings->buf + b->key_off);
|
||||
}
|
||||
|
||||
static int trie_node_add_value(struct trie *trie, struct trie_node *node,
|
||||
@@ -156,7 +160,10 @@ static int trie_node_add_value(struct trie *trie, struct trie_node *node,
|
||||
.value_off = v,
|
||||
};
|
||||
|
||||
- val = typesafe_bsearch_r(&search, node->values, node->values_count, trie_values_cmp, trie);
|
||||
+ trie_node_add_value_trie = trie;
|
||||
+ val = bsearch(&search, node->values, node->values_count, sizeof(struct trie_value_entry), trie_values_cmp);
|
||||
+ trie_node_add_value_trie = NULL;
|
||||
+
|
||||
if (val) {
|
||||
/* At this point we have 2 identical properties on the same match-string.
|
||||
* Since we process files in order, we just replace the previous value. */
|
||||
@@ -182,7 +189,9 @@ static int trie_node_add_value(struct trie *trie, struct trie_node *node,
|
||||
.line_number = line_number,
|
||||
};
|
||||
node->values_count++;
|
||||
- typesafe_qsort_r(node->values, node->values_count, trie_values_cmp, trie);
|
||||
+ trie_node_add_value_trie = trie;
|
||||
+ qsort(node->values, node->values_count, sizeof(struct trie_value_entry), trie_values_cmp);
|
||||
+ trie_node_add_value_trie = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
diff --git a/src/shared/format-table.c b/src/shared/format-table.c
|
||||
index dccb796b26..c3ab8ac296 100644
|
||||
--- a/src/shared/format-table.c
|
||||
+++ b/src/shared/format-table.c
|
||||
@@ -1290,30 +1290,32 @@ static int cell_data_compare(TableData *a, size_t index_a, TableData *b, size_t
|
||||
return CMP(index_a, index_b);
|
||||
}
|
||||
|
||||
-static int table_data_compare(const size_t *a, const size_t *b, Table *t) {
|
||||
+static Table *user_table;
|
||||
+static int table_data_compare(const void *x, const void *y) {
|
||||
+ const size_t *a = x, *b=y;
|
||||
int r;
|
||||
|
||||
- assert(t);
|
||||
- assert(t->sort_map);
|
||||
+ assert(user_table);
|
||||
+ assert(user_table->sort_map);
|
||||
|
||||
/* Make sure the header stays at the beginning */
|
||||
- if (*a < t->n_columns && *b < t->n_columns)
|
||||
+ if (*a < user_table->n_columns && *b < user_table->n_columns)
|
||||
return 0;
|
||||
- if (*a < t->n_columns)
|
||||
+ if (*a < user_table->n_columns)
|
||||
return -1;
|
||||
- if (*b < t->n_columns)
|
||||
+ if (*b < user_table->n_columns)
|
||||
return 1;
|
||||
|
||||
/* Order other lines by the sorting map */
|
||||
- for (size_t i = 0; i < t->n_sort_map; i++) {
|
||||
+ for (size_t i = 0; i < user_table->n_sort_map; i++) {
|
||||
TableData *d, *dd;
|
||||
|
||||
- d = t->data[*a + t->sort_map[i]];
|
||||
- dd = t->data[*b + t->sort_map[i]];
|
||||
+ d = user_table->data[*a + user_table->sort_map[i]];
|
||||
+ dd = user_table->data[*b + user_table->sort_map[i]];
|
||||
|
||||
r = cell_data_compare(d, *a, dd, *b);
|
||||
if (r != 0)
|
||||
- return t->reverse_map && t->reverse_map[t->sort_map[i]] ? -r : r;
|
||||
+ return user_table->reverse_map && user_table->reverse_map[user_table->sort_map[i]] ? -r : r;
|
||||
}
|
||||
|
||||
/* Order identical lines by the order there were originally added in */
|
||||
@@ -1952,7 +1954,12 @@ int table_print(Table *t, FILE *f) {
|
||||
for (size_t i = 0; i < n_rows; i++)
|
||||
sorted[i] = i * t->n_columns;
|
||||
|
||||
- typesafe_qsort_r(sorted, n_rows, table_data_compare, t);
|
||||
+ if (n_rows <= 1)
|
||||
+ return 0;
|
||||
+ assert(sorted);
|
||||
+ user_table = t;
|
||||
+ qsort(sorted, n_rows, sizeof(size_t), table_data_compare);
|
||||
+ user_table = NULL;
|
||||
}
|
||||
|
||||
if (t->display_map)
|
||||
@@ -2580,7 +2587,12 @@ int table_to_json(Table *t, JsonVariant **ret) {
|
||||
for (size_t i = 0; i < n_rows; i++)
|
||||
sorted[i] = i * t->n_columns;
|
||||
|
||||
- typesafe_qsort_r(sorted, n_rows, table_data_compare, t);
|
||||
+ if (n_rows <= 1)
|
||||
+ return 0;
|
||||
+ assert(sorted);
|
||||
+ user_table = t;
|
||||
+ qsort(sorted, n_rows, sizeof(size_t), table_data_compare);
|
||||
+ user_table = NULL;
|
||||
}
|
||||
|
||||
if (t->display_map)
|
|
@ -1,41 +0,0 @@
|
|||
From f9078501a1495c9991431d1435d081cd2e830328 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Sat, 5 Sep 2015 06:31:47 +0000
|
||||
Subject: [PATCH] implment systemd-sysv-install for OE
|
||||
|
||||
Use update-rc.d for enabling/disabling and status command
|
||||
to check the status of the sysv service
|
||||
|
||||
Upstream-Status: Inappropriate [OE-Specific]
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
|
||||
---
|
||||
src/systemctl/systemd-sysv-install.SKELETON | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/systemctl/systemd-sysv-install.SKELETON b/src/systemctl/systemd-sysv-install.SKELETON
|
||||
index 8c16cf99913f..9f078a121469 100755
|
||||
--- a/src/systemctl/systemd-sysv-install.SKELETON
|
||||
+++ b/src/systemctl/systemd-sysv-install.SKELETON
|
||||
@@ -32,17 +32,17 @@ case "$1" in
|
||||
enable)
|
||||
# call the command to enable SysV init script $NAME here
|
||||
# (consider optional $ROOT)
|
||||
- echo "IMPLEMENT ME: enabling SysV init.d script $NAME"
|
||||
+ update-rc.d -f $NAME defaults
|
||||
;;
|
||||
disable)
|
||||
# call the command to disable SysV init script $NAME here
|
||||
# (consider optional $ROOT)
|
||||
- echo "IMPLEMENT ME: disabling SysV init.d script $NAME"
|
||||
+ update-rc.d -f $NAME remove
|
||||
;;
|
||||
is-enabled)
|
||||
# exit with 0 if $NAME is enabled, non-zero if it is disabled
|
||||
# (consider optional $ROOT)
|
||||
- echo "IMPLEMENT ME: checking SysV init.d script $NAME"
|
||||
+ /etc/init.d/$NAME status
|
||||
;;
|
||||
*)
|
||||
usage ;;
|
|
@ -1,76 +0,0 @@
|
|||
From 4afb8adc83348bf75964fc10af7902e04dd62637 Mon Sep 17 00:00:00 2001
|
||||
From: Chen Qi <Qi.Chen@windriver.com>
|
||||
Date: Mon, 25 Feb 2019 13:55:12 +0800
|
||||
Subject: [PATCH] missing_type.h: add __compare_fn_t and comparison_fn_t
|
||||
|
||||
Make it work with musl where comparison_fn_t and __compare_fn_t
|
||||
is not provided.
|
||||
|
||||
Upstream-Status: Inappropriate [musl specific]
|
||||
|
||||
Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
|
||||
[Rebased for v244]
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
[Rebased for v242]
|
||||
Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
|
||||
|
||||
---
|
||||
src/basic/missing_type.h | 9 +++++++++
|
||||
src/basic/sort-util.h | 1 +
|
||||
src/core/kmod-setup.c | 1 +
|
||||
src/libsystemd/sd-journal/catalog.c | 1 +
|
||||
4 files changed, 12 insertions(+)
|
||||
|
||||
diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
|
||||
index f6233090a9..aeaf6ad5ec 100644
|
||||
--- a/src/basic/missing_type.h
|
||||
+++ b/src/basic/missing_type.h
|
||||
@@ -10,3 +10,12 @@
|
||||
#if !HAVE_CHAR16_T
|
||||
#define char16_t uint16_t
|
||||
#endif
|
||||
+
|
||||
+#ifndef __GLIBC__
|
||||
+typedef int (*comparison_fn_t)(const void *, const void *);
|
||||
+#endif
|
||||
+
|
||||
+#ifndef __COMPAR_FN_T
|
||||
+#define __COMPAR_FN_T
|
||||
+typedef int (*__compar_fn_t)(const void *, const void *);
|
||||
+#endif
|
||||
diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
|
||||
index d92a5ab0ed..a63867c716 100644
|
||||
--- a/src/basic/sort-util.h
|
||||
+++ b/src/basic/sort-util.h
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "macro.h"
|
||||
+#include "missing_type.h"
|
||||
|
||||
void *xbsearch_r(const void *key, const void *base, size_t nmemb, size_t size,
|
||||
__compar_d_fn_t compar, void *arg);
|
||||
diff --git a/src/core/kmod-setup.c b/src/core/kmod-setup.c
|
||||
index 8a7f82812a..a56f12f47f 100644
|
||||
--- a/src/core/kmod-setup.c
|
||||
+++ b/src/core/kmod-setup.c
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "kmod-setup.h"
|
||||
#include "macro.h"
|
||||
#include "string-util.h"
|
||||
+#include "missing_type.h"
|
||||
|
||||
#if HAVE_KMOD
|
||||
#include "module-util.h"
|
||||
diff --git a/src/libsystemd/sd-journal/catalog.c b/src/libsystemd/sd-journal/catalog.c
|
||||
index aea3241d18..75e6c56a28 100644
|
||||
--- a/src/libsystemd/sd-journal/catalog.c
|
||||
+++ b/src/libsystemd/sd-journal/catalog.c
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
#include "tmpfile-util.h"
|
||||
+#include "missing_type.h"
|
||||
|
||||
const char * const catalog_file_dirs[] = {
|
||||
"/usr/local/lib/systemd/catalog/",
|
|
@ -1,435 +0,0 @@
|
|||
From 6c18e5f9373da3e3b38f2c5727e2aefe07fcbbd9 Mon Sep 17 00:00:00 2001
|
||||
From: Alexander Kanavin <alex.kanavin@gmail.com>
|
||||
Date: Sat, 22 May 2021 20:26:24 +0200
|
||||
Subject: [PATCH] [PATCH] add fallback parse_printf_format implementation
|
||||
|
||||
Upstream-Status: Inappropriate [musl specific]
|
||||
|
||||
Signed-off-by: Emil Renner Berthing <systemd@esmil.dk>
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
[rebased for systemd 243]
|
||||
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
|
||||
---
|
||||
meson.build | 1 +
|
||||
src/basic/meson.build | 5 +
|
||||
src/basic/parse-printf-format.c | 273 +++++++++++++++++++++++
|
||||
src/basic/parse-printf-format.h | 57 +++++
|
||||
src/basic/stdio-util.h | 2 +-
|
||||
src/libsystemd/sd-journal/journal-send.c | 2 +-
|
||||
6 files changed, 338 insertions(+), 2 deletions(-)
|
||||
create mode 100644 src/basic/parse-printf-format.c
|
||||
create mode 100644 src/basic/parse-printf-format.h
|
||||
|
||||
diff --git a/meson.build b/meson.build
|
||||
index 27186d63a3..2abb7b3188 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -675,6 +675,7 @@ endif
|
||||
foreach header : ['crypt.h',
|
||||
'linux/memfd.h',
|
||||
'linux/vm_sockets.h',
|
||||
+ 'printf.h',
|
||||
'sys/auxv.h',
|
||||
'valgrind/memcheck.h',
|
||||
'valgrind/valgrind.h',
|
||||
diff --git a/src/basic/meson.build b/src/basic/meson.build
|
||||
index 60ef801a25..aba2172edd 100644
|
||||
--- a/src/basic/meson.build
|
||||
+++ b/src/basic/meson.build
|
||||
@@ -341,6 +341,11 @@ endforeach
|
||||
|
||||
basic_sources += generated_gperf_headers
|
||||
|
||||
+if conf.get('HAVE_PRINTF_H') != 1
|
||||
+ basic_sources += [files('parse-printf-format.c')]
|
||||
+endif
|
||||
+
|
||||
+
|
||||
############################################################
|
||||
|
||||
arch_list = [
|
||||
diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c
|
||||
new file mode 100644
|
||||
index 0000000000..49437e5445
|
||||
--- /dev/null
|
||||
+++ b/src/basic/parse-printf-format.c
|
||||
@@ -0,0 +1,273 @@
|
||||
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
|
||||
+
|
||||
+/***
|
||||
+ This file is part of systemd.
|
||||
+
|
||||
+ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
|
||||
+
|
||||
+ With parts from the musl C library
|
||||
+ Copyright 2005-2014 Rich Felker, et al.
|
||||
+
|
||||
+ systemd is free software; you can redistribute it and/or modify it
|
||||
+ under the terms of the GNU Lesser General Public License as published by
|
||||
+ the Free Software Foundation; either version 2.1 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ systemd is distributed in the hope that it will be useful, but
|
||||
+ WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ Lesser General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU Lesser General Public License
|
||||
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
+***/
|
||||
+
|
||||
+#include <stddef.h>
|
||||
+#include <string.h>
|
||||
+
|
||||
+#include "parse-printf-format.h"
|
||||
+
|
||||
+static const char *consume_nonarg(const char *fmt)
|
||||
+{
|
||||
+ do {
|
||||
+ if (*fmt == '\0')
|
||||
+ return fmt;
|
||||
+ } while (*fmt++ != '%');
|
||||
+ return fmt;
|
||||
+}
|
||||
+
|
||||
+static const char *consume_num(const char *fmt)
|
||||
+{
|
||||
+ for (;*fmt >= '0' && *fmt <= '9'; fmt++)
|
||||
+ /* do nothing */;
|
||||
+ return fmt;
|
||||
+}
|
||||
+
|
||||
+static const char *consume_argn(const char *fmt, size_t *arg)
|
||||
+{
|
||||
+ const char *p = fmt;
|
||||
+ size_t val = 0;
|
||||
+
|
||||
+ if (*p < '1' || *p > '9')
|
||||
+ return fmt;
|
||||
+ do {
|
||||
+ val = 10*val + (*p++ - '0');
|
||||
+ } while (*p >= '0' && *p <= '9');
|
||||
+
|
||||
+ if (*p != '$')
|
||||
+ return fmt;
|
||||
+ *arg = val;
|
||||
+ return p+1;
|
||||
+}
|
||||
+
|
||||
+static const char *consume_flags(const char *fmt)
|
||||
+{
|
||||
+ while (1) {
|
||||
+ switch (*fmt) {
|
||||
+ case '#':
|
||||
+ case '0':
|
||||
+ case '-':
|
||||
+ case ' ':
|
||||
+ case '+':
|
||||
+ case '\'':
|
||||
+ case 'I':
|
||||
+ fmt++;
|
||||
+ continue;
|
||||
+ }
|
||||
+ return fmt;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+enum state {
|
||||
+ BARE,
|
||||
+ LPRE,
|
||||
+ LLPRE,
|
||||
+ HPRE,
|
||||
+ HHPRE,
|
||||
+ BIGLPRE,
|
||||
+ ZTPRE,
|
||||
+ JPRE,
|
||||
+ STOP
|
||||
+};
|
||||
+
|
||||
+enum type {
|
||||
+ NONE,
|
||||
+ PTR,
|
||||
+ INT,
|
||||
+ UINT,
|
||||
+ ULLONG,
|
||||
+ LONG,
|
||||
+ ULONG,
|
||||
+ SHORT,
|
||||
+ USHORT,
|
||||
+ CHAR,
|
||||
+ UCHAR,
|
||||
+ LLONG,
|
||||
+ SIZET,
|
||||
+ IMAX,
|
||||
+ UMAX,
|
||||
+ PDIFF,
|
||||
+ UIPTR,
|
||||
+ DBL,
|
||||
+ LDBL,
|
||||
+ MAXTYPE
|
||||
+};
|
||||
+
|
||||
+static const short pa_types[MAXTYPE] = {
|
||||
+ [NONE] = PA_INT,
|
||||
+ [PTR] = PA_POINTER,
|
||||
+ [INT] = PA_INT,
|
||||
+ [UINT] = PA_INT,
|
||||
+ [ULLONG] = PA_INT | PA_FLAG_LONG_LONG,
|
||||
+ [LONG] = PA_INT | PA_FLAG_LONG,
|
||||
+ [ULONG] = PA_INT | PA_FLAG_LONG,
|
||||
+ [SHORT] = PA_INT | PA_FLAG_SHORT,
|
||||
+ [USHORT] = PA_INT | PA_FLAG_SHORT,
|
||||
+ [CHAR] = PA_CHAR,
|
||||
+ [UCHAR] = PA_CHAR,
|
||||
+ [LLONG] = PA_INT | PA_FLAG_LONG_LONG,
|
||||
+ [SIZET] = PA_INT | PA_FLAG_LONG,
|
||||
+ [IMAX] = PA_INT | PA_FLAG_LONG_LONG,
|
||||
+ [UMAX] = PA_INT | PA_FLAG_LONG_LONG,
|
||||
+ [PDIFF] = PA_INT | PA_FLAG_LONG_LONG,
|
||||
+ [UIPTR] = PA_INT | PA_FLAG_LONG,
|
||||
+ [DBL] = PA_DOUBLE,
|
||||
+ [LDBL] = PA_DOUBLE | PA_FLAG_LONG_DOUBLE
|
||||
+};
|
||||
+
|
||||
+#define S(x) [(x)-'A']
|
||||
+#define E(x) (STOP + (x))
|
||||
+
|
||||
+static const unsigned char states[]['z'-'A'+1] = {
|
||||
+ { /* 0: bare types */
|
||||
+ S('d') = E(INT), S('i') = E(INT),
|
||||
+ S('o') = E(UINT),S('u') = E(UINT),S('x') = E(UINT), S('X') = E(UINT),
|
||||
+ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
|
||||
+ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
|
||||
+ S('c') = E(CHAR),S('C') = E(INT),
|
||||
+ S('s') = E(PTR), S('S') = E(PTR), S('p') = E(UIPTR),S('n') = E(PTR),
|
||||
+ S('m') = E(NONE),
|
||||
+ S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE,
|
||||
+ S('z') = ZTPRE, S('j') = JPRE, S('t') = ZTPRE
|
||||
+ }, { /* 1: l-prefixed */
|
||||
+ S('d') = E(LONG), S('i') = E(LONG),
|
||||
+ S('o') = E(ULONG),S('u') = E(ULONG),S('x') = E(ULONG),S('X') = E(ULONG),
|
||||
+ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
|
||||
+ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
|
||||
+ S('c') = E(INT), S('s') = E(PTR), S('n') = E(PTR),
|
||||
+ S('l') = LLPRE
|
||||
+ }, { /* 2: ll-prefixed */
|
||||
+ S('d') = E(LLONG), S('i') = E(LLONG),
|
||||
+ S('o') = E(ULLONG),S('u') = E(ULLONG),
|
||||
+ S('x') = E(ULLONG),S('X') = E(ULLONG),
|
||||
+ S('n') = E(PTR)
|
||||
+ }, { /* 3: h-prefixed */
|
||||
+ S('d') = E(SHORT), S('i') = E(SHORT),
|
||||
+ S('o') = E(USHORT),S('u') = E(USHORT),
|
||||
+ S('x') = E(USHORT),S('X') = E(USHORT),
|
||||
+ S('n') = E(PTR),
|
||||
+ S('h') = HHPRE
|
||||
+ }, { /* 4: hh-prefixed */
|
||||
+ S('d') = E(CHAR), S('i') = E(CHAR),
|
||||
+ S('o') = E(UCHAR),S('u') = E(UCHAR),
|
||||
+ S('x') = E(UCHAR),S('X') = E(UCHAR),
|
||||
+ S('n') = E(PTR)
|
||||
+ }, { /* 5: L-prefixed */
|
||||
+ S('e') = E(LDBL),S('f') = E(LDBL),S('g') = E(LDBL), S('a') = E(LDBL),
|
||||
+ S('E') = E(LDBL),S('F') = E(LDBL),S('G') = E(LDBL), S('A') = E(LDBL),
|
||||
+ S('n') = E(PTR)
|
||||
+ }, { /* 6: z- or t-prefixed (assumed to be same size) */
|
||||
+ S('d') = E(PDIFF),S('i') = E(PDIFF),
|
||||
+ S('o') = E(SIZET),S('u') = E(SIZET),
|
||||
+ S('x') = E(SIZET),S('X') = E(SIZET),
|
||||
+ S('n') = E(PTR)
|
||||
+ }, { /* 7: j-prefixed */
|
||||
+ S('d') = E(IMAX), S('i') = E(IMAX),
|
||||
+ S('o') = E(UMAX), S('u') = E(UMAX),
|
||||
+ S('x') = E(UMAX), S('X') = E(UMAX),
|
||||
+ S('n') = E(PTR)
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+size_t parse_printf_format(const char *fmt, size_t n, int *types)
|
||||
+{
|
||||
+ size_t i = 0;
|
||||
+ size_t last = 0;
|
||||
+
|
||||
+ memset(types, 0, n);
|
||||
+
|
||||
+ while (1) {
|
||||
+ size_t arg;
|
||||
+ unsigned int state;
|
||||
+
|
||||
+ fmt = consume_nonarg(fmt);
|
||||
+ if (*fmt == '\0')
|
||||
+ break;
|
||||
+ if (*fmt == '%') {
|
||||
+ fmt++;
|
||||
+ continue;
|
||||
+ }
|
||||
+ arg = 0;
|
||||
+ fmt = consume_argn(fmt, &arg);
|
||||
+ /* flags */
|
||||
+ fmt = consume_flags(fmt);
|
||||
+ /* width */
|
||||
+ if (*fmt == '*') {
|
||||
+ size_t warg = 0;
|
||||
+ fmt = consume_argn(fmt+1, &warg);
|
||||
+ if (warg == 0)
|
||||
+ warg = ++i;
|
||||
+ if (warg > last)
|
||||
+ last = warg;
|
||||
+ if (warg <= n && types[warg-1] == NONE)
|
||||
+ types[warg-1] = INT;
|
||||
+ } else
|
||||
+ fmt = consume_num(fmt);
|
||||
+ /* precision */
|
||||
+ if (*fmt == '.') {
|
||||
+ fmt++;
|
||||
+ if (*fmt == '*') {
|
||||
+ size_t parg = 0;
|
||||
+ fmt = consume_argn(fmt+1, &parg);
|
||||
+ if (parg == 0)
|
||||
+ parg = ++i;
|
||||
+ if (parg > last)
|
||||
+ last = parg;
|
||||
+ if (parg <= n && types[parg-1] == NONE)
|
||||
+ types[parg-1] = INT;
|
||||
+ } else {
|
||||
+ if (*fmt == '-')
|
||||
+ fmt++;
|
||||
+ fmt = consume_num(fmt);
|
||||
+ }
|
||||
+ }
|
||||
+ /* length modifier and conversion specifier */
|
||||
+ state = BARE;
|
||||
+ do {
|
||||
+ unsigned char c = *fmt++;
|
||||
+
|
||||
+ if (c < 'A' || c > 'z')
|
||||
+ continue;
|
||||
+ state = states[state]S(c);
|
||||
+ if (state == 0)
|
||||
+ continue;
|
||||
+ } while (state < STOP);
|
||||
+
|
||||
+ if (state == E(NONE))
|
||||
+ continue;
|
||||
+
|
||||
+ if (arg == 0)
|
||||
+ arg = ++i;
|
||||
+ if (arg > last)
|
||||
+ last = arg;
|
||||
+ if (arg <= n)
|
||||
+ types[arg-1] = state - STOP;
|
||||
+ }
|
||||
+
|
||||
+ if (last > n)
|
||||
+ last = n;
|
||||
+ for (i = 0; i < last; i++)
|
||||
+ types[i] = pa_types[types[i]];
|
||||
+
|
||||
+ return last;
|
||||
+}
|
||||
diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h
|
||||
new file mode 100644
|
||||
index 0000000000..47be7522d7
|
||||
--- /dev/null
|
||||
+++ b/src/basic/parse-printf-format.h
|
||||
@@ -0,0 +1,57 @@
|
||||
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
|
||||
+
|
||||
+/***
|
||||
+ This file is part of systemd.
|
||||
+
|
||||
+ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
|
||||
+
|
||||
+ With parts from the GNU C Library
|
||||
+ Copyright 1991-2014 Free Software Foundation, Inc.
|
||||
+
|
||||
+ systemd is free software; you can redistribute it and/or modify it
|
||||
+ under the terms of the GNU Lesser General Public License as published by
|
||||
+ the Free Software Foundation; either version 2.1 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ systemd is distributed in the hope that it will be useful, but
|
||||
+ WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ Lesser General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU Lesser General Public License
|
||||
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
+***/
|
||||
+
|
||||
+#pragma once
|
||||
+
|
||||
+#include "config.h"
|
||||
+
|
||||
+#if HAVE_PRINTF_H
|
||||
+#include <printf.h>
|
||||
+#else
|
||||
+
|
||||
+#include <stddef.h>
|
||||
+
|
||||
+enum { /* C type: */
|
||||
+ PA_INT, /* int */
|
||||
+ PA_CHAR, /* int, cast to char */
|
||||
+ PA_WCHAR, /* wide char */
|
||||
+ PA_STRING, /* const char *, a '\0'-terminated string */
|
||||
+ PA_WSTRING, /* const wchar_t *, wide character string */
|
||||
+ PA_POINTER, /* void * */
|
||||
+ PA_FLOAT, /* float */
|
||||
+ PA_DOUBLE, /* double */
|
||||
+ PA_LAST
|
||||
+};
|
||||
+
|
||||
+/* Flag bits that can be set in a type returned by `parse_printf_format'. */
|
||||
+#define PA_FLAG_MASK 0xff00
|
||||
+#define PA_FLAG_LONG_LONG (1 << 8)
|
||||
+#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG
|
||||
+#define PA_FLAG_LONG (1 << 9)
|
||||
+#define PA_FLAG_SHORT (1 << 10)
|
||||
+#define PA_FLAG_PTR (1 << 11)
|
||||
+
|
||||
+size_t parse_printf_format(const char *fmt, size_t n, int *types);
|
||||
+
|
||||
+#endif /* HAVE_PRINTF_H */
|
||||
diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h
|
||||
index 6dc1e72312..cea76b36cf 100644
|
||||
--- a/src/basic/stdio-util.h
|
||||
+++ b/src/basic/stdio-util.h
|
||||
@@ -1,13 +1,13 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
-#include <printf.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "macro.h"
|
||||
#include "memory-util.h"
|
||||
+#include "parse-printf-format.h"
|
||||
|
||||
#define snprintf_ok(buf, len, fmt, ...) \
|
||||
((size_t) snprintf(buf, len, fmt, __VA_ARGS__) < (len))
|
||||
diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
|
||||
index fd3fd7ef9c..e8e6ad555b 100644
|
||||
--- a/src/libsystemd/sd-journal/journal-send.c
|
||||
+++ b/src/libsystemd/sd-journal/journal-send.c
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
-#include <printf.h>
|
||||
#include <stddef.h>
|
||||
#include <sys/un.h>
|
||||
#include <unistd.h>
|
||||
@@ -21,6 +20,7 @@
|
||||
#include "stdio-util.h"
|
||||
#include "string-util.h"
|
||||
#include "tmpfile-util.h"
|
||||
+#include "parse-printf-format.h"
|
||||
|
||||
#define SNDBUF_SIZE (8*1024*1024)
|
||||
|
||||
--
|
||||
2.24.0
|
||||
|
|
@ -1,602 +0,0 @@
|
|||
From 6b0732ac7164914ce16e231e35980b849bdfc4c8 Mon Sep 17 00:00:00 2001
|
||||
From: Chen Qi <Qi.Chen@windriver.com>
|
||||
Date: Mon, 25 Feb 2019 14:18:21 +0800
|
||||
Subject: [PATCH] src/basic/missing.h: check for missing strndupa
|
||||
|
||||
include missing.h for definition of strndupa
|
||||
|
||||
Upstream-Status: Inappropriate [musl specific]
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
[Rebased for v242]
|
||||
Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
|
||||
[rebased for systemd 243]
|
||||
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
|
||||
Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
|
||||
[rebased for systemd 244]
|
||||
[Rebased for v247]
|
||||
Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
|
||||
|
||||
---
|
||||
meson.build | 1 +
|
||||
src/backlight/backlight.c | 1 +
|
||||
src/basic/cgroup-util.c | 1 +
|
||||
src/basic/env-util.c | 1 +
|
||||
src/basic/log.c | 1 +
|
||||
src/basic/missing_stdlib.h | 12 ++++++++++++
|
||||
src/basic/mkdir.c | 1 +
|
||||
src/basic/mountpoint-util.c | 1 +
|
||||
src/basic/parse-util.c | 1 +
|
||||
src/basic/path-lookup.c | 1 +
|
||||
src/basic/proc-cmdline.c | 1 +
|
||||
src/basic/procfs-util.c | 1 +
|
||||
src/basic/selinux-util.c | 1 +
|
||||
src/basic/time-util.c | 1 +
|
||||
src/boot/bless-boot.c | 1 +
|
||||
src/core/dbus-cgroup.c | 1 +
|
||||
src/core/dbus-execute.c | 1 +
|
||||
src/core/dbus-util.c | 1 +
|
||||
src/core/execute.c | 1 +
|
||||
src/core/kmod-setup.c | 1 +
|
||||
src/core/service.c | 1 +
|
||||
src/coredump/coredump-vacuum.c | 1 +
|
||||
src/journal-remote/journal-remote-main.c | 1 +
|
||||
src/journal/journalctl.c | 1 +
|
||||
src/libsystemd/sd-bus/bus-message.c | 1 +
|
||||
src/libsystemd/sd-bus/bus-objects.c | 1 +
|
||||
src/libsystemd/sd-bus/bus-socket.c | 1 +
|
||||
src/libsystemd/sd-bus/sd-bus.c | 1 +
|
||||
src/libsystemd/sd-bus/test-bus-benchmark.c | 1 +
|
||||
src/libsystemd/sd-journal/sd-journal.c | 1 +
|
||||
src/locale/keymap-util.c | 1 +
|
||||
src/login/pam_systemd.c | 1 +
|
||||
src/network/generator/network-generator.c | 1 +
|
||||
src/nspawn/nspawn-settings.c | 1 +
|
||||
src/nss-mymachines/nss-mymachines.c | 1 +
|
||||
src/portable/portable.c | 1 +
|
||||
src/resolve/resolvectl.c | 1 +
|
||||
src/shared/bus-get-properties.c | 1 +
|
||||
src/shared/bus-unit-procs.c | 1 +
|
||||
src/shared/bus-unit-util.c | 1 +
|
||||
src/shared/bus-util.c | 1 +
|
||||
src/shared/dns-domain.c | 1 +
|
||||
src/shared/journal-importer.c | 1 +
|
||||
src/shared/logs-show.c | 1 +
|
||||
src/shared/pager.c | 1 +
|
||||
src/shared/uid-range.c | 1 +
|
||||
src/socket-proxy/socket-proxyd.c | 1 +
|
||||
src/test/test-hexdecoct.c | 1 +
|
||||
src/udev/udev-builtin-path_id.c | 1 +
|
||||
src/udev/udev-event.c | 1 +
|
||||
src/udev/udev-rules.c | 1 +
|
||||
51 files changed, 62 insertions(+)
|
||||
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -550,6 +550,7 @@ foreach ident : [
|
||||
['execveat', '''#include <unistd.h>'''],
|
||||
['close_range', '''#include <unistd.h>'''],
|
||||
['epoll_pwait2', '''#include <sys/epoll.h>'''],
|
||||
+ ['strndupa' , '''#include <string.h>'''],
|
||||
]
|
||||
|
||||
have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')
|
||||
--- a/src/backlight/backlight.c
|
||||
+++ b/src/backlight/backlight.c
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
#include "util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
static int help(void) {
|
||||
_cleanup_free_ char *link = NULL;
|
||||
--- a/src/basic/cgroup-util.c
|
||||
+++ b/src/basic/cgroup-util.c
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "unit-name.h"
|
||||
#include "user-util.h"
|
||||
#include "xattr-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
static int cg_enumerate_items(const char *controller, const char *path, FILE **_f, const char *item) {
|
||||
_cleanup_free_ char *fs = NULL;
|
||||
--- a/src/basic/env-util.c
|
||||
+++ b/src/basic/env-util.c
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
#include "utf8.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
/* We follow bash for the character set. Different shells have different rules. */
|
||||
#define VALID_BASH_ENV_NAME_CHARS \
|
||||
--- a/src/basic/log.c
|
||||
+++ b/src/basic/log.c
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "terminal-util.h"
|
||||
#include "time-util.h"
|
||||
#include "utf8.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
#define SNDBUF_SIZE (8*1024*1024)
|
||||
|
||||
--- a/src/basic/missing_stdlib.h
|
||||
+++ b/src/basic/missing_stdlib.h
|
||||
@@ -11,3 +11,15 @@
|
||||
# error "neither secure_getenv nor __secure_getenv are available"
|
||||
# endif
|
||||
#endif
|
||||
+
|
||||
+/* string.h */
|
||||
+#if ! HAVE_STRNDUPA
|
||||
+#define strndupa(s, n) \
|
||||
+ ({ \
|
||||
+ const char *__old = (s); \
|
||||
+ size_t __len = strnlen(__old, (n)); \
|
||||
+ char *__new = (char *)alloca(__len + 1); \
|
||||
+ __new[__len] = '\0'; \
|
||||
+ (char *)memcpy(__new, __old, __len); \
|
||||
+ })
|
||||
+#endif
|
||||
--- a/src/basic/mkdir.c
|
||||
+++ b/src/basic/mkdir.c
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "stat-util.h"
|
||||
#include "stdio-util.h"
|
||||
#include "user-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
int mkdir_safe_internal(
|
||||
const char *path,
|
||||
--- a/src/basic/mountpoint-util.c
|
||||
+++ b/src/basic/mountpoint-util.c
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "missing_stat.h"
|
||||
#include "missing_syscall.h"
|
||||
#include "mkdir.h"
|
||||
+#include "missing_stdlib.h"
|
||||
#include "mountpoint-util.h"
|
||||
#include "parse-util.h"
|
||||
#include "path-util.h"
|
||||
--- a/src/basic/parse-util.c
|
||||
+++ b/src/basic/parse-util.c
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "stat-util.h"
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
int parse_boolean(const char *v) {
|
||||
if (!v)
|
||||
--- a/src/basic/path-lookup.c
|
||||
+++ b/src/basic/path-lookup.c
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "strv.h"
|
||||
#include "tmpfile-util.h"
|
||||
#include "user-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
int xdg_user_runtime_dir(char **ret, const char *suffix) {
|
||||
const char *e;
|
||||
--- a/src/basic/proc-cmdline.c
|
||||
+++ b/src/basic/proc-cmdline.c
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "string-util.h"
|
||||
#include "util.h"
|
||||
#include "virt.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
int proc_cmdline(char **ret) {
|
||||
const char *e;
|
||||
--- a/src/basic/procfs-util.c
|
||||
+++ b/src/basic/procfs-util.c
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "procfs-util.h"
|
||||
#include "stdio-util.h"
|
||||
#include "string-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
int procfs_tasks_get_limit(uint64_t *ret) {
|
||||
_cleanup_free_ char *value = NULL;
|
||||
--- a/src/basic/selinux-util.c
|
||||
+++ b/src/basic/selinux-util.c
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "selinux-util.h"
|
||||
#include "stdio-util.h"
|
||||
#include "time-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
#if HAVE_SELINUX
|
||||
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(context_t, context_free, NULL);
|
||||
--- a/src/basic/time-util.c
|
||||
+++ b/src/basic/time-util.c
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
#include "time-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
static clockid_t map_clock_id(clockid_t c) {
|
||||
|
||||
--- a/src/boot/bless-boot.c
|
||||
+++ b/src/boot/bless-boot.c
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "util.h"
|
||||
#include "verbs.h"
|
||||
#include "virt.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
static char **arg_path = NULL;
|
||||
|
||||
--- a/src/core/dbus-cgroup.c
|
||||
+++ b/src/core/dbus-cgroup.c
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "limits-util.h"
|
||||
#include "path-util.h"
|
||||
#include "percent-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
BUS_DEFINE_PROPERTY_GET(bus_property_get_tasks_max, "t", TasksMax, tasks_max_resolve);
|
||||
|
||||
--- a/src/core/dbus-execute.c
|
||||
+++ b/src/core/dbus-execute.c
|
||||
@@ -41,6 +41,7 @@
|
||||
#include "unit-printf.h"
|
||||
#include "user-util.h"
|
||||
#include "utf8.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
BUS_DEFINE_PROPERTY_GET_ENUM(bus_property_get_exec_output, exec_output, ExecOutput);
|
||||
static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_exec_input, exec_input, ExecInput);
|
||||
--- a/src/core/dbus-util.c
|
||||
+++ b/src/core/dbus-util.c
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "unit-printf.h"
|
||||
#include "user-util.h"
|
||||
#include "unit.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
int bus_property_get_triggered_unit(
|
||||
sd_bus *bus,
|
||||
--- a/src/core/execute.c
|
||||
+++ b/src/core/execute.c
|
||||
@@ -96,6 +96,7 @@
|
||||
#include "unit-serialize.h"
|
||||
#include "user-util.h"
|
||||
#include "utmp-wtmp.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
#define IDLE_TIMEOUT_USEC (5*USEC_PER_SEC)
|
||||
#define IDLE_TIMEOUT2_USEC (1*USEC_PER_SEC)
|
||||
--- a/src/core/kmod-setup.c
|
||||
+++ b/src/core/kmod-setup.c
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "macro.h"
|
||||
#include "string-util.h"
|
||||
#include "missing_type.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
#if HAVE_KMOD
|
||||
#include "module-util.h"
|
||||
--- a/src/core/service.c
|
||||
+++ b/src/core/service.c
|
||||
@@ -41,6 +41,7 @@
|
||||
#include "unit.h"
|
||||
#include "utf8.h"
|
||||
#include "util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
static const UnitActiveState state_translation_table[_SERVICE_STATE_MAX] = {
|
||||
[SERVICE_DEAD] = UNIT_INACTIVE,
|
||||
--- a/src/coredump/coredump-vacuum.c
|
||||
+++ b/src/coredump/coredump-vacuum.c
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "string-util.h"
|
||||
#include "time-util.h"
|
||||
#include "user-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
#define DEFAULT_MAX_USE_LOWER (uint64_t) (1ULL*1024ULL*1024ULL) /* 1 MiB */
|
||||
#define DEFAULT_MAX_USE_UPPER (uint64_t) (4ULL*1024ULL*1024ULL*1024ULL) /* 4 GiB */
|
||||
--- a/src/journal-remote/journal-remote-main.c
|
||||
+++ b/src/journal-remote/journal-remote-main.c
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "stat-util.h"
|
||||
#include "string-table.h"
|
||||
#include "strv.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
#define PRIV_KEY_FILE CERTIFICATE_ROOT "/private/journal-remote.pem"
|
||||
#define CERT_FILE CERTIFICATE_ROOT "/certs/journal-remote.pem"
|
||||
--- a/src/journal/journalctl.c
|
||||
+++ b/src/journal/journalctl.c
|
||||
@@ -72,6 +72,7 @@
|
||||
#include "unit-name.h"
|
||||
#include "user-util.h"
|
||||
#include "varlink.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
#define DEFAULT_FSS_INTERVAL_USEC (15*USEC_PER_MINUTE)
|
||||
#define PROCESS_INOTIFY_INTERVAL 1024 /* Every 1,024 messages processed */
|
||||
--- a/src/libsystemd/sd-bus/bus-message.c
|
||||
+++ b/src/libsystemd/sd-bus/bus-message.c
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "strv.h"
|
||||
#include "time-util.h"
|
||||
#include "utf8.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
static int message_append_basic(sd_bus_message *m, char type, const void *p, const void **stored);
|
||||
|
||||
--- a/src/libsystemd/sd-bus/bus-objects.c
|
||||
+++ b/src/libsystemd/sd-bus/bus-objects.c
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "set.h"
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
static int node_vtable_get_userdata(
|
||||
sd_bus *bus,
|
||||
--- a/src/libsystemd/sd-bus/bus-socket.c
|
||||
+++ b/src/libsystemd/sd-bus/bus-socket.c
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "string-util.h"
|
||||
#include "user-util.h"
|
||||
#include "utf8.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
#define SNDBUF_SIZE (8*1024*1024)
|
||||
|
||||
--- a/src/libsystemd/sd-bus/sd-bus.c
|
||||
+++ b/src/libsystemd/sd-bus/sd-bus.c
|
||||
@@ -41,6 +41,7 @@
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
#include "user-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
#define log_debug_bus_message(m) \
|
||||
do { \
|
||||
--- a/src/libsystemd/sd-bus/test-bus-benchmark.c
|
||||
+++ b/src/libsystemd/sd-bus/test-bus-benchmark.c
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "string-util.h"
|
||||
#include "time-util.h"
|
||||
#include "util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
#define MAX_SIZE (2*1024*1024)
|
||||
|
||||
--- a/src/libsystemd/sd-journal/sd-journal.c
|
||||
+++ b/src/libsystemd/sd-journal/sd-journal.c
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
#include "syslog-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
#define JOURNAL_FILES_MAX 7168
|
||||
|
||||
--- a/src/locale/keymap-util.c
|
||||
+++ b/src/locale/keymap-util.c
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
#include "tmpfile-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
static bool startswith_comma(const char *s, const char *prefix) {
|
||||
s = startswith(s, prefix);
|
||||
--- a/src/login/pam_systemd.c
|
||||
+++ b/src/login/pam_systemd.c
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "locale-util.h"
|
||||
#include "login-util.h"
|
||||
#include "macro.h"
|
||||
+#include "missing_stdlib.h"
|
||||
#include "pam-util.h"
|
||||
#include "parse-util.h"
|
||||
#include "path-util.h"
|
||||
--- a/src/network/generator/network-generator.c
|
||||
+++ b/src/network/generator/network-generator.c
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "string-table.h"
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
/*
|
||||
# .network
|
||||
--- a/src/nspawn/nspawn-settings.c
|
||||
+++ b/src/nspawn/nspawn-settings.c
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "strv.h"
|
||||
#include "user-util.h"
|
||||
#include "util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
Settings *settings_new(void) {
|
||||
Settings *s;
|
||||
--- a/src/nss-mymachines/nss-mymachines.c
|
||||
+++ b/src/nss-mymachines/nss-mymachines.c
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "nss-util.h"
|
||||
#include "signal-util.h"
|
||||
#include "string-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
static void setup_logging(void) {
|
||||
/* We need a dummy function because log_parse_environment is a macro. */
|
||||
--- a/src/portable/portable.c
|
||||
+++ b/src/portable/portable.c
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "strv.h"
|
||||
#include "tmpfile-util.h"
|
||||
#include "user-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
static const char profile_dirs[] = CONF_PATHS_NULSTR("systemd/portable/profile");
|
||||
|
||||
--- a/src/resolve/resolvectl.c
|
||||
+++ b/src/resolve/resolvectl.c
|
||||
@@ -41,6 +41,7 @@
|
||||
#include "terminal-util.h"
|
||||
#include "utf8.h"
|
||||
#include "verbs.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
static int arg_family = AF_UNSPEC;
|
||||
static int arg_ifindex = 0;
|
||||
--- a/src/shared/bus-get-properties.c
|
||||
+++ b/src/shared/bus-get-properties.c
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "rlimit-util.h"
|
||||
#include "stdio-util.h"
|
||||
#include "string-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
int bus_property_get_bool(
|
||||
sd_bus *bus,
|
||||
--- a/src/shared/bus-unit-procs.c
|
||||
+++ b/src/shared/bus-unit-procs.c
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "sort-util.h"
|
||||
#include "string-util.h"
|
||||
#include "terminal-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
struct CGroupInfo {
|
||||
char *cgroup_path;
|
||||
--- a/src/shared/bus-unit-util.c
|
||||
+++ b/src/shared/bus-unit-util.c
|
||||
@@ -45,6 +45,7 @@
|
||||
#include "unit-def.h"
|
||||
#include "user-util.h"
|
||||
#include "utf8.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
int bus_parse_unit_info(sd_bus_message *message, UnitInfo *u) {
|
||||
assert(message);
|
||||
--- a/src/shared/bus-util.c
|
||||
+++ b/src/shared/bus-util.c
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "path-util.h"
|
||||
#include "socket-util.h"
|
||||
#include "stdio-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
static int name_owner_change_callback(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) {
|
||||
sd_event *e = userdata;
|
||||
--- a/src/shared/dns-domain.c
|
||||
+++ b/src/shared/dns-domain.c
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
#include "utf8.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
int dns_label_unescape(const char **name, char *dest, size_t sz, DNSLabelFlags flags) {
|
||||
const char *n;
|
||||
--- a/src/shared/journal-importer.c
|
||||
+++ b/src/shared/journal-importer.c
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "parse-util.h"
|
||||
#include "string-util.h"
|
||||
#include "unaligned.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
enum {
|
||||
IMPORTER_STATE_LINE = 0, /* waiting to read, or reading line */
|
||||
--- a/src/shared/logs-show.c
|
||||
+++ b/src/shared/logs-show.c
|
||||
@@ -41,6 +41,7 @@
|
||||
#include "utf8.h"
|
||||
#include "util.h"
|
||||
#include "web-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
/* up to three lines (each up to 100 characters) or 300 characters, whichever is less */
|
||||
#define PRINT_LINE_THRESHOLD 3
|
||||
--- a/src/shared/pager.c
|
||||
+++ b/src/shared/pager.c
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "strv.h"
|
||||
#include "terminal-util.h"
|
||||
#include "util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
static pid_t pager_pid = 0;
|
||||
|
||||
--- a/src/shared/uid-range.c
|
||||
+++ b/src/shared/uid-range.c
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "sort-util.h"
|
||||
#include "uid-range.h"
|
||||
#include "user-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
static bool uid_range_intersect(UidRange *range, uid_t start, uid_t nr) {
|
||||
assert(range);
|
||||
--- a/src/socket-proxy/socket-proxyd.c
|
||||
+++ b/src/socket-proxy/socket-proxyd.c
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "socket-util.h"
|
||||
#include "string-util.h"
|
||||
#include "util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
#define BUFFER_SIZE (256 * 1024)
|
||||
|
||||
--- a/src/test/test-hexdecoct.c
|
||||
+++ b/src/test/test-hexdecoct.c
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "hexdecoct.h"
|
||||
#include "macro.h"
|
||||
#include "string-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
static void test_hexchar(void) {
|
||||
assert_se(hexchar(0xa) == 'a');
|
||||
--- a/src/udev/udev-builtin-path_id.c
|
||||
+++ b/src/udev/udev-builtin-path_id.c
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "sysexits.h"
|
||||
#include "udev-builtin.h"
|
||||
#include "udev-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
_printf_(2,3)
|
||||
static void path_prepend(char **path, const char *fmt, ...) {
|
||||
--- a/src/udev/udev-event.c
|
||||
+++ b/src/udev/udev-event.c
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "udev-util.h"
|
||||
#include "udev-watch.h"
|
||||
#include "user-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
typedef struct Spawn {
|
||||
sd_device *device;
|
||||
--- a/src/udev/udev-rules.c
|
||||
+++ b/src/udev/udev-rules.c
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "udev-rules.h"
|
||||
#include "user-util.h"
|
||||
#include "virt.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
#define RULES_DIRS (const char* const*) CONF_PATHS_STRV("udev/rules.d")
|
||||
|
||||
--- a/src/basic/percent-util.c
|
||||
+++ b/src/basic/percent-util.c
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "percent-util.h"
|
||||
#include "string-util.h"
|
||||
#include "parse-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
static int parse_parts_value_whole(const char *p, const char *symbol) {
|
||||
const char *pc, *n;
|
|
@ -1,326 +0,0 @@
|
|||
From 2069f0b0d5ab8f869aeba635a347e0b11d362b30 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Thu, 26 Oct 2017 22:10:42 -0700
|
||||
Subject: [PATCH] Include netinet/if_ether.h
|
||||
|
||||
Fixes
|
||||
/path/to/systemd/recipe-sysroot/usr/include/netinet/if_ether.h:101:8: error: redefinition of 'struct ethhdr'
|
||||
struct ethhdr {
|
||||
^~~~~~
|
||||
|
||||
and related arphdr, arpreq, and arpreq_old errors
|
||||
/path/to/systemd/recipe-sysroot/usr/include/net/if_arp.h:22:8: error: redefinition of 'struct arphdr'
|
||||
struct arphdr {
|
||||
^~~~~~
|
||||
|
||||
The latter requires removing some includes of net/if_arp.h to avoid
|
||||
conflicting with netinet/if_ether.h.
|
||||
|
||||
Upstream-Status: Inappropriate [musl specific]
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
[rebased for systemd 243]
|
||||
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
|
||||
|
||||
Upstream-Status: Inappropriate [musl specific]
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
[rebased for systemd 243]
|
||||
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
|
||||
[rebased for systemd 247]
|
||||
Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
|
||||
|
||||
---
|
||||
src/libsystemd-network/sd-dhcp6-client.c | 1 -
|
||||
src/libsystemd/sd-netlink/netlink-types.c | 1 +
|
||||
src/machine/machine-dbus.c | 1 +
|
||||
src/network/netdev/bond.c | 1 +
|
||||
src/network/netdev/bridge.c | 1 +
|
||||
src/network/netdev/macsec.c | 1 +
|
||||
src/network/netdev/netdev-gperf.gperf | 1 +
|
||||
src/network/netdev/netdev.c | 1 +
|
||||
src/network/networkd-brvlan.c | 1 +
|
||||
src/network/networkd-dhcp-common.c | 4 +++-
|
||||
src/network/networkd-dhcp-server.c | 4 ++--
|
||||
src/network/networkd-dhcp4.c | 2 +-
|
||||
src/network/networkd-dhcp6.c | 2 +-
|
||||
src/network/networkd-link.c | 2 +-
|
||||
src/network/networkd-network.c | 1 +
|
||||
src/network/networkd-route.c | 5 ++++-
|
||||
src/network/test-network-tables.c | 1 +
|
||||
src/shared/ethtool-util.c | 1 +
|
||||
src/shared/ethtool-util.h | 1 +
|
||||
src/udev/net/link-config.c | 1 +
|
||||
src/udev/udev-builtin-net_setup_link.c | 1 +
|
||||
21 files changed, 26 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
|
||||
index 410bfda10e..e70ed8be92 100644
|
||||
--- a/src/libsystemd-network/sd-dhcp6-client.c
|
||||
+++ b/src/libsystemd-network/sd-dhcp6-client.c
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
-#include <linux/if_arp.h>
|
||||
#include <linux/if_infiniband.h>
|
||||
|
||||
#include "sd-dhcp6-client.h"
|
||||
diff --git a/src/libsystemd/sd-netlink/netlink-types.c b/src/libsystemd/sd-netlink/netlink-types.c
|
||||
index ed7b9a8cd1..112c0b09e4 100644
|
||||
--- a/src/libsystemd/sd-netlink/netlink-types.c
|
||||
+++ b/src/libsystemd/sd-netlink/netlink-types.c
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <netinet/in.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/socket.h>
|
||||
+#include <netinet/if_ether.h>
|
||||
#include <linux/can/vxcan.h>
|
||||
#include <linux/netlink.h>
|
||||
#include <linux/rtnetlink.h>
|
||||
diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c
|
||||
index e7c4ed3c7c..3a1e4f9072 100644
|
||||
--- a/src/machine/machine-dbus.c
|
||||
+++ b/src/machine/machine-dbus.c
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <errno.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/wait.h>
|
||||
+#include <netinet/if_ether.h>
|
||||
|
||||
/* When we include libgen.h because we need dirname() we immediately
|
||||
* undefine basename() since libgen.h defines it as a macro to the POSIX
|
||||
diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c
|
||||
index cf7ca88d6f..34ab468191 100644
|
||||
--- a/src/network/netdev/bond.c
|
||||
+++ b/src/network/netdev/bond.c
|
||||
@@ -1,5 +1,6 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
+#include <netinet/if_ether.h>
|
||||
#include "alloc-util.h"
|
||||
#include "bond.h"
|
||||
#include "bond-util.h"
|
||||
diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c
|
||||
index 38432f1578..79ccfe578e 100644
|
||||
--- a/src/network/netdev/bridge.c
|
||||
+++ b/src/network/netdev/bridge.c
|
||||
@@ -1,5 +1,6 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
+#include <netinet/if_ether.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#include "bridge.h"
|
||||
diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c
|
||||
index 77c5f8c4e7..04be1b4ab2 100644
|
||||
--- a/src/network/netdev/macsec.c
|
||||
+++ b/src/network/netdev/macsec.c
|
||||
@@ -1,5 +1,6 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
+#include <netinet/if_ether.h>
|
||||
#include <netinet/in.h>
|
||||
#include <linux/if_ether.h>
|
||||
#include <linux/if_macsec.h>
|
||||
diff --git a/src/network/netdev/netdev-gperf.gperf b/src/network/netdev/netdev-gperf.gperf
|
||||
index 8abe044890..3c54c58928 100644
|
||||
--- a/src/network/netdev/netdev-gperf.gperf
|
||||
+++ b/src/network/netdev/netdev-gperf.gperf
|
||||
@@ -3,6 +3,7 @@
|
||||
#if __GNUC__ >= 7
|
||||
_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
|
||||
#endif
|
||||
+#include <netinet/if_ether.h>
|
||||
#include <stddef.h>
|
||||
#include "bareudp.h"
|
||||
#include "batadv.h"
|
||||
diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
|
||||
index b31f0fa81a..c80e1ff537 100644
|
||||
--- a/src/network/netdev/netdev.c
|
||||
+++ b/src/network/netdev/netdev.c
|
||||
@@ -1,5 +1,6 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
+#include <netinet/if_ether.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
#include <unistd.h>
|
||||
diff --git a/src/network/networkd-brvlan.c b/src/network/networkd-brvlan.c
|
||||
index 2847b336c9..4d6af8c642 100644
|
||||
--- a/src/network/networkd-brvlan.c
|
||||
+++ b/src/network/networkd-brvlan.c
|
||||
@@ -4,6 +4,7 @@
|
||||
***/
|
||||
|
||||
#include <netinet/in.h>
|
||||
+#include <netinet/if_ether.h>
|
||||
#include <linux/if_bridge.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
|
||||
index 00d055cf8d..65821c1d31 100644
|
||||
--- a/src/network/networkd-dhcp-common.c
|
||||
+++ b/src/network/networkd-dhcp-common.c
|
||||
@@ -1,7 +1,8 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
#include <netinet/in.h>
|
||||
-#include <linux/if_arp.h>
|
||||
+#include <net/if_arp.h>
|
||||
+#include <net/if.h>
|
||||
|
||||
#include "bus-error.h"
|
||||
#include "dhcp-internal.h"
|
||||
@@ -11,6 +12,7 @@
|
||||
#include "networkd-dhcp-common.h"
|
||||
#include "networkd-link.h"
|
||||
#include "networkd-manager.h"
|
||||
+#include <netinet/if_ether.h>
|
||||
#include "networkd-network.h"
|
||||
#include "parse-util.h"
|
||||
#include "socket-util.h"
|
||||
diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c
|
||||
index 5cdf432c27..93cffb9863 100644
|
||||
--- a/src/network/networkd-dhcp-server.c
|
||||
+++ b/src/network/networkd-dhcp-server.c
|
||||
@@ -1,8 +1,8 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
#include <netinet/in.h>
|
||||
-#include <linux/if_arp.h>
|
||||
-#include <linux/if.h>
|
||||
+#include <net/if_arp.h>
|
||||
+#include <net/if.h>
|
||||
|
||||
#include "sd-dhcp-server.h"
|
||||
|
||||
diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
|
||||
index 23dc3a45db..7ae6c2467a 100644
|
||||
--- a/src/network/networkd-dhcp4.c
|
||||
+++ b/src/network/networkd-dhcp4.c
|
||||
@@ -1,9 +1,9 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
+#include <netinet/if_ether.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <linux/if.h>
|
||||
-#include <linux/if_arp.h>
|
||||
|
||||
#include "escape.h"
|
||||
#include "alloc-util.h"
|
||||
diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c
|
||||
index aa077d6219..4f6ce22059 100644
|
||||
--- a/src/network/networkd-dhcp6.c
|
||||
+++ b/src/network/networkd-dhcp6.c
|
||||
@@ -3,9 +3,9 @@
|
||||
Copyright © 2014 Intel Corporation. All rights reserved.
|
||||
***/
|
||||
|
||||
+#include <netinet/if_ether.h>
|
||||
#include <netinet/in.h>
|
||||
#include <linux/if.h>
|
||||
-#include <linux/if_arp.h>
|
||||
|
||||
#include "sd-dhcp6-client.h"
|
||||
|
||||
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
|
||||
index 8219d95b0d..c92230453b 100644
|
||||
--- a/src/network/networkd-link.c
|
||||
+++ b/src/network/networkd-link.c
|
||||
@@ -1,8 +1,8 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
+#include <netinet/if_ether.h>
|
||||
#include <netinet/in.h>
|
||||
#include <linux/if.h>
|
||||
-#include <linux/if_arp.h>
|
||||
#include <linux/if_link.h>
|
||||
#include <unistd.h>
|
||||
|
||||
diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c
|
||||
index e5ffd35b6f..871ebb32c6 100644
|
||||
--- a/src/network/networkd-network.c
|
||||
+++ b/src/network/networkd-network.c
|
||||
@@ -1,5 +1,6 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
+#include <netinet/if_ether.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
#include <linux/netdevice.h>
|
||||
diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c
|
||||
index a74541a6c9..a10549b336 100644
|
||||
--- a/src/network/networkd-route.c
|
||||
+++ b/src/network/networkd-route.c
|
||||
@@ -1,7 +1,10 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
#include <linux/icmpv6.h>
|
||||
-#include <linux/ipv6_route.h>
|
||||
+/* linux/ipv6_route.h conflicts with netinet/in.h so define manually */
|
||||
+#ifndef IP6_RT_PRIO_USER
|
||||
+#define IP6_RT_PRIO_USER 1024
|
||||
+#endif
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "netlink-util.h"
|
||||
diff --git a/src/network/test-network-tables.c b/src/network/test-network-tables.c
|
||||
index ce34449554..0b5dc01182 100644
|
||||
--- a/src/network/test-network-tables.c
|
||||
+++ b/src/network/test-network-tables.c
|
||||
@@ -1,5 +1,6 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
+#include <netinet/if_ether.h>
|
||||
#include "bond.h"
|
||||
#include "dhcp6-internal.h"
|
||||
#include "dhcp6-protocol.h"
|
||||
diff --git a/src/shared/ethtool-util.c b/src/shared/ethtool-util.c
|
||||
index 654d36a83a..f4ed42d543 100644
|
||||
--- a/src/shared/ethtool-util.c
|
||||
+++ b/src/shared/ethtool-util.c
|
||||
@@ -1,5 +1,6 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
+#include <netinet/if_ether.h>
|
||||
#include <net/if.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/ethtool.h>
|
||||
diff --git a/src/shared/ethtool-util.h b/src/shared/ethtool-util.h
|
||||
index 11e2906681..a171df0737 100644
|
||||
--- a/src/shared/ethtool-util.h
|
||||
+++ b/src/shared/ethtool-util.h
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <macro.h>
|
||||
#include <net/ethernet.h>
|
||||
+#include <netinet/if_ether.h>
|
||||
#include <linux/ethtool.h>
|
||||
|
||||
#include "conf-parser.h"
|
||||
diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c
|
||||
index 31e5d0cd67..f25f821364 100644
|
||||
--- a/src/udev/net/link-config.c
|
||||
+++ b/src/udev/net/link-config.c
|
||||
@@ -1,5 +1,6 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
+#include <netinet/if_ether.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <netinet/ether.h>
|
||||
#include <unistd.h>
|
||||
diff --git a/src/udev/udev-builtin-net_setup_link.c b/src/udev/udev-builtin-net_setup_link.c
|
||||
index 87e1fb133e..13876029d0 100644
|
||||
--- a/src/udev/udev-builtin-net_setup_link.c
|
||||
+++ b/src/udev/udev-builtin-net_setup_link.c
|
||||
@@ -1,5 +1,6 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
+#include <netinet/if_ether.h>
|
||||
#include "alloc-util.h"
|
||||
#include "device-util.h"
|
||||
#include "errno-util.h"
|
|
@ -1,153 +0,0 @@
|
|||
From bca73ff2fbff2dc311040a87a4f536f89af07ad6 Mon Sep 17 00:00:00 2001
|
||||
From: Chen Qi <Qi.Chen@windriver.com>
|
||||
Date: Mon, 25 Feb 2019 14:56:21 +0800
|
||||
Subject: [PATCH] don't fail if GLOB_BRACE and GLOB_ALTDIRFUNC is not defined
|
||||
|
||||
If the standard library doesn't provide brace
|
||||
expansion users just won't get it.
|
||||
|
||||
Dont use GNU GLOB extentions on non-glibc systems
|
||||
|
||||
Conditionalize use of GLOB_ALTDIRFUNC
|
||||
|
||||
Upstream-Status: Inappropriate [musl specific]
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
[rebased for systemd 243]
|
||||
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
|
||||
|
||||
---
|
||||
src/basic/glob-util.c | 12 ++++++++++++
|
||||
src/test/test-glob-util.c | 16 ++++++++++++++++
|
||||
src/tmpfiles/tmpfiles.c | 10 ++++++++++
|
||||
3 files changed, 38 insertions(+)
|
||||
|
||||
diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c
|
||||
index bc0278e57f..c973f82e54 100644
|
||||
--- a/src/basic/glob-util.c
|
||||
+++ b/src/basic/glob-util.c
|
||||
@@ -12,6 +12,12 @@
|
||||
#include "path-util.h"
|
||||
#include "strv.h"
|
||||
|
||||
+/* Don't fail if the standard library
|
||||
+ * doesn't provide brace expansion */
|
||||
+#ifndef GLOB_BRACE
|
||||
+#define GLOB_BRACE 0
|
||||
+#endif
|
||||
+
|
||||
static void closedir_wrapper(void* v) {
|
||||
(void) closedir(v);
|
||||
}
|
||||
@@ -19,6 +25,7 @@ static void closedir_wrapper(void* v) {
|
||||
int safe_glob(const char *path, int flags, glob_t *pglob) {
|
||||
int k;
|
||||
|
||||
+#ifdef GLOB_ALTDIRFUNC
|
||||
/* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */
|
||||
assert(!(flags & GLOB_ALTDIRFUNC));
|
||||
|
||||
@@ -32,9 +39,14 @@ int safe_glob(const char *path, int flags, glob_t *pglob) {
|
||||
pglob->gl_lstat = lstat;
|
||||
if (!pglob->gl_stat)
|
||||
pglob->gl_stat = stat;
|
||||
+#endif
|
||||
|
||||
errno = 0;
|
||||
+#ifdef GLOB_ALTDIRFUNC
|
||||
k = glob(path, flags | GLOB_ALTDIRFUNC, NULL, pglob);
|
||||
+#else
|
||||
+ k = glob(path, flags, NULL, pglob);
|
||||
+#endif
|
||||
if (k == GLOB_NOMATCH)
|
||||
return -ENOENT;
|
||||
if (k == GLOB_NOSPACE)
|
||||
diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c
|
||||
index df6444c433..79a692046e 100644
|
||||
--- a/src/test/test-glob-util.c
|
||||
+++ b/src/test/test-glob-util.c
|
||||
@@ -12,6 +12,12 @@
|
||||
#include "rm-rf.h"
|
||||
#include "tmpfile-util.h"
|
||||
|
||||
+/* Don't fail if the standard library
|
||||
+ * doesn't provide brace expansion */
|
||||
+#ifndef GLOB_BRACE
|
||||
+#define GLOB_BRACE 0
|
||||
+#endif
|
||||
+
|
||||
static void test_glob_exists(void) {
|
||||
char name[] = "/tmp/test-glob_exists.XXXXXX";
|
||||
int fd = -1;
|
||||
@@ -39,11 +45,13 @@ static void test_glob_no_dot(void) {
|
||||
const char *fn;
|
||||
|
||||
_cleanup_globfree_ glob_t g = {
|
||||
+#ifdef GLOB_ALTDIRFUNC
|
||||
.gl_closedir = closedir_wrapper,
|
||||
.gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot,
|
||||
.gl_opendir = (void *(*)(const char *)) opendir,
|
||||
.gl_lstat = lstat,
|
||||
.gl_stat = stat,
|
||||
+#endif
|
||||
};
|
||||
|
||||
int r;
|
||||
@@ -51,11 +59,19 @@ static void test_glob_no_dot(void) {
|
||||
assert_se(mkdtemp(template));
|
||||
|
||||
fn = strjoina(template, "/*");
|
||||
+#ifdef GLOB_ALTDIRFUNC
|
||||
r = glob(fn, GLOB_NOSORT|GLOB_BRACE|GLOB_ALTDIRFUNC, NULL, &g);
|
||||
+#else
|
||||
+ r = glob(fn, GLOB_NOSORT|GLOB_BRACE, NULL, &g);
|
||||
+#endif
|
||||
assert_se(r == GLOB_NOMATCH);
|
||||
|
||||
fn = strjoina(template, "/.*");
|
||||
+#ifdef GLOB_ALTDIRFUNC
|
||||
r = glob(fn, GLOB_NOSORT|GLOB_BRACE|GLOB_ALTDIRFUNC, NULL, &g);
|
||||
+#else
|
||||
+ r = glob(fn, GLOB_NOSORT|GLOB_BRACE, NULL, &g);
|
||||
+#endif
|
||||
assert_se(r == GLOB_NOMATCH);
|
||||
|
||||
(void) rm_rf(template, REMOVE_ROOT|REMOVE_PHYSICAL);
|
||||
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
|
||||
index 6b73d1e6d5..26b3b74275 100644
|
||||
--- a/src/tmpfiles/tmpfiles.c
|
||||
+++ b/src/tmpfiles/tmpfiles.c
|
||||
@@ -66,6 +66,12 @@
|
||||
#include "umask-util.h"
|
||||
#include "user-util.h"
|
||||
|
||||
+/* Don't fail if the standard library
|
||||
+ * doesn't provide brace expansion */
|
||||
+#ifndef GLOB_BRACE
|
||||
+#define GLOB_BRACE 0
|
||||
+#endif
|
||||
+
|
||||
/* This reads all files listed in /etc/tmpfiles.d/?*.conf and creates
|
||||
* them in the file system. This is intended to be used to create
|
||||
* properly owned directories beneath /tmp, /var/tmp, /run, which are
|
||||
@@ -1947,7 +1953,9 @@ finish:
|
||||
|
||||
static int glob_item(Item *i, action_t action) {
|
||||
_cleanup_globfree_ glob_t g = {
|
||||
+#ifdef GLOB_ALTDIRFUNC
|
||||
.gl_opendir = (void *(*)(const char *)) opendir_nomod,
|
||||
+#endif
|
||||
};
|
||||
int r = 0, k;
|
||||
char **fn;
|
||||
@@ -1967,7 +1975,9 @@ static int glob_item(Item *i, action_t action) {
|
||||
|
||||
static int glob_item_recursively(Item *i, fdaction_t action) {
|
||||
_cleanup_globfree_ glob_t g = {
|
||||
+#ifdef GLOB_ALTDIRFUNC
|
||||
.gl_opendir = (void *(*)(const char *)) opendir_nomod,
|
||||
+#endif
|
||||
};
|
||||
int r = 0, k;
|
||||
char **fn;
|
|
@ -1,45 +0,0 @@
|
|||
From e0d1912f0246c97e5e7b4177691363d2d077e11d Mon Sep 17 00:00:00 2001
|
||||
From: Chen Qi <Qi.Chen@windriver.com>
|
||||
Date: Mon, 25 Feb 2019 15:00:06 +0800
|
||||
Subject: [PATCH] add missing FTW_ macros for musl
|
||||
|
||||
This is to avoid build failures like below for musl.
|
||||
|
||||
locale-util.c:296:24: error: 'FTW_STOP' undeclared
|
||||
|
||||
Upstream-Status: Inappropriate [musl specific]
|
||||
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
|
||||
---
|
||||
src/basic/missing_type.h | 20 ++++++++++++++++++++
|
||||
1 file changed, 20 insertions(+)
|
||||
|
||||
diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
|
||||
index aeaf6ad5ec..3df1084ef2 100644
|
||||
--- a/src/basic/missing_type.h
|
||||
+++ b/src/basic/missing_type.h
|
||||
@@ -19,3 +19,23 @@ typedef int (*comparison_fn_t)(const void *, const void *);
|
||||
#define __COMPAR_FN_T
|
||||
typedef int (*__compar_fn_t)(const void *, const void *);
|
||||
#endif
|
||||
+
|
||||
+#ifndef FTW_ACTIONRETVAL
|
||||
+#define FTW_ACTIONRETVAL 16
|
||||
+#endif
|
||||
+
|
||||
+#ifndef FTW_CONTINUE
|
||||
+#define FTW_CONTINUE 0
|
||||
+#endif
|
||||
+
|
||||
+#ifndef FTW_STOP
|
||||
+#define FTW_STOP 1
|
||||
+#endif
|
||||
+
|
||||
+#ifndef FTW_SKIP_SUBTREE
|
||||
+#define FTW_SKIP_SUBTREE 2
|
||||
+#endif
|
||||
+
|
||||
+#ifndef FTW_SKIP_SIBLINGS
|
||||
+#define FTW_SKIP_SIBLINGS 3
|
||||
+#endif
|
|
@ -1,43 +0,0 @@
|
|||
From bb41fe773881a8f1d9615d388320b9c6fc47bfe5 Mon Sep 17 00:00:00 2001
|
||||
From: Chen Qi <Qi.Chen@windriver.com>
|
||||
Date: Mon, 25 Feb 2019 15:03:47 +0800
|
||||
Subject: [PATCH] fix missing of __register_atfork for non-glibc builds
|
||||
|
||||
Upstream-Status: Inappropriate [musl specific]
|
||||
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
|
||||
---
|
||||
src/basic/process-util.c | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/src/basic/process-util.c b/src/basic/process-util.c
|
||||
index 7d4301eadb..caa9dfe3a3 100644
|
||||
--- a/src/basic/process-util.c
|
||||
+++ b/src/basic/process-util.c
|
||||
@@ -18,6 +18,9 @@
|
||||
#if HAVE_VALGRIND_VALGRIND_H
|
||||
#include <valgrind/valgrind.h>
|
||||
#endif
|
||||
+#ifndef __GLIBC__
|
||||
+#include <pthread.h>
|
||||
+#endif
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "architecture.h"
|
||||
@@ -1121,11 +1124,15 @@ void reset_cached_pid(void) {
|
||||
cached_pid = CACHED_PID_UNSET;
|
||||
}
|
||||
|
||||
+#ifdef __GLIBC__
|
||||
/* We use glibc __register_atfork() + __dso_handle directly here, as they are not included in the glibc
|
||||
* headers. __register_atfork() is mostly equivalent to pthread_atfork(), but doesn't require us to link against
|
||||
* libpthread, as it is part of glibc anyway. */
|
||||
extern int __register_atfork(void (*prepare) (void), void (*parent) (void), void (*child) (void), void *dso_handle);
|
||||
extern void* __dso_handle _weak_;
|
||||
+#else
|
||||
+#define __register_atfork(prepare,parent,child,dso) pthread_atfork(prepare,parent,child)
|
||||
+#endif
|
||||
|
||||
pid_t getpid_cached(void) {
|
||||
static bool installed = false;
|
|
@ -1,104 +0,0 @@
|
|||
From dc40487e0ac26e3ca317429b9c3e8f01772de60a Mon Sep 17 00:00:00 2001
|
||||
From: Chen Qi <Qi.Chen@windriver.com>
|
||||
Date: Mon, 25 Feb 2019 15:12:41 +0800
|
||||
Subject: [PATCH] Use uintmax_t for handling rlim_t
|
||||
|
||||
PRIu{32,64} is not right format to represent rlim_t type
|
||||
therefore use %ju and typecast the rlim_t variables to
|
||||
uintmax_t.
|
||||
|
||||
Fixes portablility errors like
|
||||
|
||||
execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=]
|
||||
| fprintf(f, "%s%s: " RLIM_FMT "\n",
|
||||
| ^~~~~~~~
|
||||
| prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Upstream-Status: Denied [https://github.com/systemd/systemd/pull/7199]
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
[Rebased for v241]
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
|
||||
---
|
||||
src/basic/format-util.h | 8 +-------
|
||||
src/basic/rlimit-util.c | 10 +++++-----
|
||||
src/core/execute.c | 4 ++--
|
||||
3 files changed, 8 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/src/basic/format-util.h b/src/basic/format-util.h
|
||||
index b7e18768e3..3195ab205d 100644
|
||||
--- a/src/basic/format-util.h
|
||||
+++ b/src/basic/format-util.h
|
||||
@@ -32,13 +32,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t));
|
||||
# define PRI_TIMEX "li"
|
||||
#endif
|
||||
|
||||
-#if SIZEOF_RLIM_T == 8
|
||||
-# define RLIM_FMT "%" PRIu64
|
||||
-#elif SIZEOF_RLIM_T == 4
|
||||
-# define RLIM_FMT "%" PRIu32
|
||||
-#else
|
||||
-# error Unknown rlim_t size
|
||||
-#endif
|
||||
+#define RLIM_FMT "%ju"
|
||||
|
||||
#if SIZEOF_DEV_T == 8
|
||||
# define DEV_FMT "%" PRIu64
|
||||
diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c
|
||||
index 23d108d5df..b037734ee3 100644
|
||||
--- a/src/basic/rlimit-util.c
|
||||
+++ b/src/basic/rlimit-util.c
|
||||
@@ -43,7 +43,7 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) {
|
||||
fixed.rlim_max == highest.rlim_max)
|
||||
return 0;
|
||||
|
||||
- log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", rlim->rlim_max, rlimit_to_string(resource), fixed.rlim_max);
|
||||
+ log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", (uintmax_t)rlim->rlim_max, rlimit_to_string(resource), (uintmax_t)fixed.rlim_max);
|
||||
|
||||
if (setrlimit(resource, &fixed) < 0)
|
||||
return -errno;
|
||||
@@ -308,13 +308,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) {
|
||||
if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY)
|
||||
s = strdup("infinity");
|
||||
else if (rl->rlim_cur >= RLIM_INFINITY)
|
||||
- (void) asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max);
|
||||
+ (void) asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max);
|
||||
else if (rl->rlim_max >= RLIM_INFINITY)
|
||||
- (void) asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur);
|
||||
+ (void) asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur);
|
||||
else if (rl->rlim_cur == rl->rlim_max)
|
||||
- (void) asprintf(&s, RLIM_FMT, rl->rlim_cur);
|
||||
+ (void) asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur);
|
||||
else
|
||||
- (void) asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max);
|
||||
+ (void) asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max);
|
||||
|
||||
if (!s)
|
||||
return -ENOMEM;
|
||||
@@ -405,7 +405,7 @@ int rlimit_nofile_safe(void) {
|
||||
|
||||
rl.rlim_cur = FD_SETSIZE;
|
||||
if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
|
||||
- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur);
|
||||
+ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur);
|
||||
|
||||
return 1;
|
||||
}
|
||||
diff --git a/src/core/execute.c b/src/core/execute.c
|
||||
index f82fc294c0..4696d055a8 100644
|
||||
--- a/src/core/execute.c
|
||||
+++ b/src/core/execute.c
|
||||
@@ -5370,9 +5370,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
|
||||
for (unsigned i = 0; i < RLIM_NLIMITS; i++)
|
||||
if (c->rlimit[i]) {
|
||||
fprintf(f, "%sLimit%s: " RLIM_FMT "\n",
|
||||
- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
|
||||
+ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max);
|
||||
fprintf(f, "%sLimit%sSoft: " RLIM_FMT "\n",
|
||||
- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur);
|
||||
+ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur);
|
||||
}
|
||||
|
||||
if (c->ioprio_set) {
|
|
@ -1,39 +0,0 @@
|
|||
From f8be7b283309e4332eedc088774daac637afef7b Mon Sep 17 00:00:00 2001
|
||||
From: Chen Qi <Qi.Chen@windriver.com>
|
||||
Date: Wed, 28 Feb 2018 21:25:22 -0800
|
||||
Subject: [PATCH] test-sizeof.c: Disable tests for missing typedefs in musl
|
||||
|
||||
Upstream-Status: Inappropriate [musl specific]
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
|
||||
---
|
||||
src/test/test-sizeof.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c
|
||||
index 3c9dc180fa..e1a59d408c 100644
|
||||
--- a/src/test/test-sizeof.c
|
||||
+++ b/src/test/test-sizeof.c
|
||||
@@ -55,8 +55,10 @@ int main(void) {
|
||||
info(unsigned);
|
||||
info(long unsigned);
|
||||
info(long long unsigned);
|
||||
+#ifdef __GLIBC__
|
||||
info(__syscall_ulong_t);
|
||||
info(__syscall_slong_t);
|
||||
+#endif
|
||||
|
||||
info(float);
|
||||
info(double);
|
||||
@@ -74,7 +76,9 @@ int main(void) {
|
||||
info(ssize_t);
|
||||
info(time_t);
|
||||
info(usec_t);
|
||||
+#ifdef __GLIBC__
|
||||
info(__time_t);
|
||||
+#endif
|
||||
info(pid_t);
|
||||
info(uid_t);
|
||||
info(gid_t);
|
|
@ -1,98 +0,0 @@
|
|||
From 06915b70735caa66987af758ebdc4207757ae758 Mon Sep 17 00:00:00 2001
|
||||
From: Andre McCurdy <armccurdy@gmail.com>
|
||||
Date: Tue, 10 Oct 2017 14:33:30 -0700
|
||||
Subject: [PATCH] don't pass AT_SYMLINK_NOFOLLOW flag to faccessat()
|
||||
|
||||
Avoid using AT_SYMLINK_NOFOLLOW flag. It doesn't seem like the right
|
||||
thing to do and it's not portable (not supported by musl). See:
|
||||
|
||||
http://lists.landley.net/pipermail/toybox-landley.net/2014-September/003610.html
|
||||
http://www.openwall.com/lists/musl/2015/02/05/2
|
||||
|
||||
Note that laccess() is never passing AT_EACCESS so a lot of the
|
||||
discussion in the links above doesn't apply. Note also that
|
||||
(currently) all systemd callers of laccess() pass mode as F_OK, so
|
||||
only check for existence of a file, not access permissions.
|
||||
Therefore, in this case, the only distiction between faccessat()
|
||||
with (flag == 0) and (flag == AT_SYMLINK_NOFOLLOW) is the behaviour
|
||||
for broken symlinks; laccess() on a broken symlink will succeed with
|
||||
(flag == AT_SYMLINK_NOFOLLOW) and fail (flag == 0).
|
||||
|
||||
The laccess() macros was added to systemd some time ago and it's not
|
||||
clear if or why it needs to return success for broken symlinks. Maybe
|
||||
just historical and not actually necessary or desired behaviour?
|
||||
|
||||
Upstream-Status: Inappropriate [musl specific]
|
||||
|
||||
Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
|
||||
|
||||
---
|
||||
src/basic/fs-util.h | 23 +++++++++++++++++++++--
|
||||
src/shared/base-filesystem.c | 6 +++---
|
||||
2 files changed, 24 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/basic/fs-util.h b/src/basic/fs-util.h
|
||||
index 027037f7a7..16eb379caf 100644
|
||||
--- a/src/basic/fs-util.h
|
||||
+++ b/src/basic/fs-util.h
|
||||
@@ -44,8 +44,27 @@ int futimens_opath(int fd, const struct timespec ts[2]);
|
||||
int fd_warn_permissions(const char *path, int fd);
|
||||
int stat_warn_permissions(const char *path, const struct stat *st);
|
||||
|
||||
-#define laccess(path, mode) \
|
||||
- (faccessat(AT_FDCWD, (path), (mode), AT_SYMLINK_NOFOLLOW) < 0 ? -errno : 0)
|
||||
+/*
|
||||
+ Avoid using AT_SYMLINK_NOFOLLOW flag. It doesn't seem like the right thing to
|
||||
+ do and it's not portable (not supported by musl). See:
|
||||
+
|
||||
+ http://lists.landley.net/pipermail/toybox-landley.net/2014-September/003610.html
|
||||
+ http://www.openwall.com/lists/musl/2015/02/05/2
|
||||
+
|
||||
+ Note that laccess() is never passing AT_EACCESS so a lot of the discussion in
|
||||
+ the links above doesn't apply. Note also that (currently) all systemd callers
|
||||
+ of laccess() pass mode as F_OK, so only check for existence of a file, not
|
||||
+ access permissions. Therefore, in this case, the only distiction between
|
||||
+ faccessat() with (flag == 0) and (flag == AT_SYMLINK_NOFOLLOW) is the
|
||||
+ behaviour for broken symlinks; laccess() on a broken symlink will succeed
|
||||
+ with (flag == AT_SYMLINK_NOFOLLOW) and fail (flag == 0).
|
||||
+
|
||||
+ The laccess() macros was added to systemd some time ago and it's not clear if
|
||||
+ or why it needs to return success for broken symlinks. Maybe just historical
|
||||
+ and not actually necessary or desired behaviour?
|
||||
+*/
|
||||
+
|
||||
+#define laccess(path, mode) faccessat(AT_FDCWD, (path), (mode), 0)
|
||||
|
||||
int touch_file(const char *path, bool parents, usec_t stamp, uid_t uid, gid_t gid, mode_t mode);
|
||||
int touch(const char *path);
|
||||
diff --git a/src/shared/base-filesystem.c b/src/shared/base-filesystem.c
|
||||
index 1d05409086..1ed06c31ab 100644
|
||||
--- a/src/shared/base-filesystem.c
|
||||
+++ b/src/shared/base-filesystem.c
|
||||
@@ -54,7 +54,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) {
|
||||
return log_error_errno(errno, "Failed to open root file system: %m");
|
||||
|
||||
for (i = 0; i < ELEMENTSOF(table); i ++) {
|
||||
- if (faccessat(fd, table[i].dir, F_OK, AT_SYMLINK_NOFOLLOW) >= 0)
|
||||
+ if (faccessat(fd, table[i].dir, F_OK, 0) >= 0)
|
||||
continue;
|
||||
|
||||
if (table[i].target) {
|
||||
@@ -62,7 +62,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) {
|
||||
|
||||
/* check if one of the targets exists */
|
||||
NULSTR_FOREACH(s, table[i].target) {
|
||||
- if (faccessat(fd, s, F_OK, AT_SYMLINK_NOFOLLOW) < 0)
|
||||
+ if (faccessat(fd, s, F_OK, 0) < 0)
|
||||
continue;
|
||||
|
||||
/* check if a specific file exists at the target path */
|
||||
@@ -73,7 +73,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) {
|
||||
if (!p)
|
||||
return log_oom();
|
||||
|
||||
- if (faccessat(fd, p, F_OK, AT_SYMLINK_NOFOLLOW) < 0)
|
||||
+ if (faccessat(fd, p, F_OK, 0) < 0)
|
||||
continue;
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
From 0c44af262cfa07c57db4b32de1f7610af47797f4 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Sun, 27 May 2018 08:36:44 -0700
|
||||
Subject: [PATCH] Define glibc compatible basename() for non-glibc systems
|
||||
|
||||
Fixes builds with musl, even though systemd is adamant about
|
||||
using non-posix basename implementation, we have a way out
|
||||
|
||||
Upstream-Status: Inappropriate [musl specific]
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
|
||||
---
|
||||
src/machine/machine-dbus.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c
|
||||
index 3a1e4f9072..ab87b9882c 100644
|
||||
--- a/src/machine/machine-dbus.c
|
||||
+++ b/src/machine/machine-dbus.c
|
||||
@@ -11,6 +11,11 @@
|
||||
#include <libgen.h>
|
||||
#undef basename
|
||||
|
||||
+#if !defined(__GLIBC__)
|
||||
+#include <string.h>
|
||||
+#define basename(src) (strrchr(src,'/') ? strrchr(src,'/')+1 : src)
|
||||
+#endif
|
||||
+
|
||||
#include "alloc-util.h"
|
||||
#include "bus-common-errors.h"
|
||||
#include "bus-get-properties.h"
|
|
@ -1,39 +0,0 @@
|
|||
From 0f4b60e34a806055c678eb97a7ec7e21291bcf48 Mon Sep 17 00:00:00 2001
|
||||
From: Chen Qi <Qi.Chen@windriver.com>
|
||||
Date: Wed, 4 Jul 2018 15:00:44 +0800
|
||||
Subject: [PATCH] Do not disable buffering when writing to oom_score_adj
|
||||
|
||||
On musl, disabling buffering when writing to oom_score_adj will
|
||||
cause the following error.
|
||||
|
||||
Failed to adjust OOM setting: Invalid argument
|
||||
|
||||
This error appears for systemd-udevd.service and dbus.service.
|
||||
This is because kernel receives '-' instead of the whole '-900'
|
||||
if buffering is disabled.
|
||||
|
||||
This is libc implementation specific, as glibc does not have this issue.
|
||||
|
||||
Upstream-Status: Inappropriate [musl specific]
|
||||
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
[rebased for systemd 243]
|
||||
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
|
||||
|
||||
---
|
||||
src/basic/process-util.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/basic/process-util.c b/src/basic/process-util.c
|
||||
index caa9dfe3a3..6101f43db5 100644
|
||||
--- a/src/basic/process-util.c
|
||||
+++ b/src/basic/process-util.c
|
||||
@@ -1523,7 +1523,7 @@ int set_oom_score_adjust(int value) {
|
||||
sprintf(t, "%i", value);
|
||||
|
||||
return write_string_file("/proc/self/oom_score_adj", t,
|
||||
- WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ WRITE_STRING_FILE_VERIFY_ON_FAILURE);
|
||||
}
|
||||
|
||||
int pidfd_get_pid(int fd, pid_t *ret) {
|
|
@ -1,60 +0,0 @@
|
|||
From c30ab62d18ce88187f5eb6c236e0977c9337f68d Mon Sep 17 00:00:00 2001
|
||||
From: Chen Qi <Qi.Chen@windriver.com>
|
||||
Date: Tue, 10 Jul 2018 15:40:17 +0800
|
||||
Subject: [PATCH] distinguish XSI-compliant strerror_r from GNU-specifi
|
||||
strerror_r
|
||||
|
||||
XSI-compliant strerror_r and GNU-specifi strerror_r are different.
|
||||
|
||||
int strerror_r(int errnum, char *buf, size_t buflen);
|
||||
/* XSI-compliant */
|
||||
|
||||
char *strerror_r(int errnum, char *buf, size_t buflen);
|
||||
/* GNU-specific */
|
||||
|
||||
We need to distinguish between them. Otherwise, we'll get an int value
|
||||
assigned to (char *) variable, resulting in segment fault.
|
||||
|
||||
Upstream-Status: Inappropriate [musl specific]
|
||||
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
|
||||
---
|
||||
src/libsystemd/sd-bus/bus-error.c | 5 +++++
|
||||
src/libsystemd/sd-journal/journal-send.c | 5 +++++
|
||||
2 files changed, 10 insertions(+)
|
||||
|
||||
diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
|
||||
index 8da2024a50..9605a9b869 100644
|
||||
--- a/src/libsystemd/sd-bus/bus-error.c
|
||||
+++ b/src/libsystemd/sd-bus/bus-error.c
|
||||
@@ -392,7 +392,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) {
|
||||
return;
|
||||
|
||||
errno = 0;
|
||||
+#ifndef __GLIBC__
|
||||
+ strerror_r(error, m, k);
|
||||
+ x = m;
|
||||
+#else
|
||||
x = strerror_r(error, m, k);
|
||||
+#endif
|
||||
if (errno == ERANGE || strlen(x) >= k - 1) {
|
||||
free(m);
|
||||
k *= 2;
|
||||
diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
|
||||
index e8e6ad555b..8ca5271d02 100644
|
||||
--- a/src/libsystemd/sd-journal/journal-send.c
|
||||
+++ b/src/libsystemd/sd-journal/journal-send.c
|
||||
@@ -348,7 +348,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove
|
||||
char* j;
|
||||
|
||||
errno = 0;
|
||||
+#ifndef __GLIBC__
|
||||
+ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
|
||||
+ j = buffer + 8 + k;
|
||||
+#else
|
||||
j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
|
||||
+#endif
|
||||
if (errno == 0) {
|
||||
char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1];
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
From fa86e5578256dddb296fd30128929ea7c4b792a4 Mon Sep 17 00:00:00 2001
|
||||
From: Chen Qi <Qi.Chen@windriver.com>
|
||||
Date: Mon, 25 Feb 2019 15:18:00 +0800
|
||||
Subject: [PATCH] Hide __start_BUS_ERROR_MAP and __stop_BUS_ERROR_MAP
|
||||
|
||||
for currently unknown reasons they get exported to the shared libries
|
||||
even without being listed in the sym file
|
||||
|
||||
Upstream-Status: Pending
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
[Rebased for v241]
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
|
||||
---
|
||||
src/libsystemd/sd-bus/bus-error.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
|
||||
index 9605a9b869..38b6cf90c3 100644
|
||||
--- a/src/libsystemd/sd-bus/bus-error.c
|
||||
+++ b/src/libsystemd/sd-bus/bus-error.c
|
||||
@@ -55,8 +55,8 @@ BUS_ERROR_MAP_ELF_REGISTER const sd_bus_error_map bus_standard_errors[] = {
|
||||
};
|
||||
|
||||
/* GCC maps this magically to the beginning and end of the BUS_ERROR_MAP section */
|
||||
-extern const sd_bus_error_map __start_SYSTEMD_BUS_ERROR_MAP[];
|
||||
-extern const sd_bus_error_map __stop_SYSTEMD_BUS_ERROR_MAP[];
|
||||
+extern const sd_bus_error_map __start_SYSTEMD_BUS_ERROR_MAP[] _hidden_;
|
||||
+extern const sd_bus_error_map __stop_SYSTEMD_BUS_ERROR_MAP[] _hidden_;
|
||||
|
||||
/* Additional maps registered with sd_bus_error_add_map() are in this
|
||||
* NULL terminated array */
|
|
@ -1,28 +0,0 @@
|
|||
From 11e730694706fa354a0e43c588ef66677a777d9a Mon Sep 17 00:00:00 2001
|
||||
From: Chen Qi <Qi.Chen@windriver.com>
|
||||
Date: Mon, 25 Feb 2019 15:27:54 +0800
|
||||
Subject: [PATCH] missing_type.h: add __compar_d_fn_t definition
|
||||
|
||||
Fix the following compile failure:
|
||||
src/basic/util.h:71:18: error: unknown type name '__compar_d_fn_t'; did you mean '__compar_fn_t'?
|
||||
|
||||
Upstream-Status: Inappropriate [musl specific]
|
||||
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
|
||||
---
|
||||
src/basic/missing_type.h | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
|
||||
index 3df1084ef2..697aa7f58a 100644
|
||||
--- a/src/basic/missing_type.h
|
||||
+++ b/src/basic/missing_type.h
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
#ifndef __GLIBC__
|
||||
typedef int (*comparison_fn_t)(const void *, const void *);
|
||||
+typedef int (*__compar_d_fn_t) (const void *, const void *, void *);
|
||||
#endif
|
||||
|
||||
#ifndef __COMPAR_FN_T
|
|
@ -1,30 +0,0 @@
|
|||
From 45bae28d3da6607d33d54f4b30a500f5249aadde Mon Sep 17 00:00:00 2001
|
||||
From: Chen Qi <Qi.Chen@windriver.com>
|
||||
Date: Mon, 25 Feb 2019 15:44:54 +0800
|
||||
Subject: [PATCH] avoid redefinition of prctl_mm_map structure
|
||||
|
||||
Fix the following compile failure:
|
||||
error: redefinition of 'struct prctl_mm_map'
|
||||
|
||||
Upstream-Status: Inappropriate [musl specific]
|
||||
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
|
||||
---
|
||||
src/basic/missing_prctl.h | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h
|
||||
index ab851306ba..5547cad875 100644
|
||||
--- a/src/basic/missing_prctl.h
|
||||
+++ b/src/basic/missing_prctl.h
|
||||
@@ -1,7 +1,9 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
+#ifdef __GLIBC__
|
||||
#include <linux/prctl.h>
|
||||
+#endif
|
||||
|
||||
/* 58319057b7847667f0c9585b9de0e8932b0fdb08 (4.3) */
|
||||
#ifndef PR_CAP_AMBIENT
|
|
@ -1,24 +0,0 @@
|
|||
From 6e593ff2afbe4bfe15eee2ec34e51490a38462f5 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Kiernan <alex.kiernan@gmail.com>
|
||||
Date: Fri, 7 Aug 2020 15:19:27 +0000
|
||||
Subject: [PATCH] Handle missing LOCK_EX
|
||||
|
||||
Upstream-Status: Inappropriate [musl specific]
|
||||
Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
|
||||
|
||||
---
|
||||
src/partition/makefs.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/partition/makefs.c b/src/partition/makefs.c
|
||||
index 7c94fbfedb..42f966722d 100644
|
||||
--- a/src/partition/makefs.c
|
||||
+++ b/src/partition/makefs.c
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
+#include <sys/file.h>
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "blockdev-util.h"
|
|
@ -1,38 +0,0 @@
|
|||
From ac579b296aa29c2f1dad9425c6d795e154ec8f7c Mon Sep 17 00:00:00 2001
|
||||
From: Alex Kiernan <alex.kiernan@gmail.com>
|
||||
Date: Fri, 7 Aug 2020 15:20:17 +0000
|
||||
Subject: [PATCH] Fix incompatible pointer type struct sockaddr_un *
|
||||
|
||||
| ../../../../../../workspace/sources/systemd/src/nspawn/nspawn.c: In function 'cant_be_in_netns':
|
||||
| ../../../../../../workspace/sources/systemd/src/nspawn/nspawn.c:4893:25: error: passing argument 2 of 'connect' from incompatible pointer type [-Werror=incompatible-pointer-types]
|
||||
| 4893 | if (connect(fd, &sa.un, SOCKADDR_UN_LEN(sa.un)) < 0) {
|
||||
| | ^~~~~~
|
||||
| | |
|
||||
| | struct sockaddr_un *
|
||||
| In file included from ../../../../../../workspace/sources/systemd/src/systemd/sd-daemon.h:22,
|
||||
| from ../../../../../../workspace/sources/systemd/src/nspawn/nspawn.c:21:
|
||||
| /home/ubuntu/poky/build/tmp/work/core2-64-poky-linux-musl/systemd/1_246-r0/recipe-sysroot/usr/include/sys/socket.h:384:19: note: expected 'const struct sockaddr *' but argument is of type 'struct sockaddr_un *'
|
||||
| 384 | int connect (int, const struct sockaddr *, socklen_t);
|
||||
| | ^~~~~~~~~~~~~~~~~~~~~~~
|
||||
| cc1: some warnings being treated as errors
|
||||
|
||||
Upstream-Status: Inappropriate [musl specific]
|
||||
Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
|
||||
|
||||
---
|
||||
src/nspawn/nspawn.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
|
||||
index a4ac8ed2bb..0c41a48d4b 100644
|
||||
--- a/src/nspawn/nspawn.c
|
||||
+++ b/src/nspawn/nspawn.c
|
||||
@@ -5125,7 +5125,7 @@ static int cant_be_in_netns(void) {
|
||||
if (fd < 0)
|
||||
return log_error_errno(errno, "Failed to allocate udev control socket: %m");
|
||||
|
||||
- if (connect(fd, &sa.un, SOCKADDR_UN_LEN(sa.un)) < 0) {
|
||||
+ if (connect(fd, (struct sockaddr *)&sa.un, SOCKADDR_UN_LEN(sa.un)) < 0) {
|
||||
|
||||
if (errno == ENOENT || ERRNO_IS_DISCONNECT(errno))
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
|
|
@ -1,31 +0,0 @@
|
|||
From 6bc78df50adb48d24a2abfdf65b44b932cc5a571 Mon Sep 17 00:00:00 2001
|
||||
From: Chen Qi <Qi.Chen@windriver.com>
|
||||
Date: Mon, 25 Feb 2019 16:53:06 +0800
|
||||
Subject: [PATCH] test-json.c: define M_PIl
|
||||
|
||||
Fix the following compile failure:
|
||||
src/test/test-json.c:305:50: error: 'M_PIl' undeclared (first use in this function); did you mean 'M_PI'?
|
||||
|
||||
Upstream-Status: Inappropriate [musl specific]
|
||||
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
|
||||
---
|
||||
src/test/test-json.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/src/test/test-json.c b/src/test/test-json.c
|
||||
index 1d4b11945e..572c8cf9d0 100644
|
||||
--- a/src/test/test-json.c
|
||||
+++ b/src/test/test-json.c
|
||||
@@ -13,6 +13,10 @@
|
||||
#include "tests.h"
|
||||
#include "util.h"
|
||||
|
||||
+#ifndef M_PIl
|
||||
+#define M_PIl 3.141592653589793238462643383279502884L
|
||||
+#endif
|
||||
+
|
||||
static void test_tokenizer(const char *data, ...) {
|
||||
unsigned line = 0, column = 0;
|
||||
void *state = NULL;
|
|
@ -1,383 +0,0 @@
|
|||
From 7cb6579572b50ef44bc0a321a4c73cce55b0c2f2 Mon Sep 17 00:00:00 2001
|
||||
From: Chen Qi <Qi.Chen@windriver.com>
|
||||
Date: Fri, 1 Mar 2019 15:22:15 +0800
|
||||
Subject: [PATCH] do not disable buffer in writing files
|
||||
|
||||
Do not disable buffer in writing files, otherwise we get
|
||||
failure at boot for musl like below.
|
||||
|
||||
[!!!!!!] Failed to allocate manager object.
|
||||
|
||||
And there will be other failures, critical or not critical.
|
||||
This is specific to musl.
|
||||
|
||||
Upstream-Status: Inappropriate [musl]
|
||||
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
[Rebased for v242]
|
||||
Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
|
||||
[rebased for systemd 243]
|
||||
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
|
||||
|
||||
---
|
||||
src/basic/cgroup-util.c | 10 +++++-----
|
||||
src/basic/procfs-util.c | 4 ++--
|
||||
src/basic/smack-util.c | 2 +-
|
||||
src/basic/sysctl-util.c | 2 +-
|
||||
src/basic/util.c | 2 +-
|
||||
src/binfmt/binfmt.c | 6 +++---
|
||||
src/core/main.c | 4 ++--
|
||||
src/core/smack-setup.c | 8 ++++----
|
||||
src/hibernate-resume/hibernate-resume.c | 2 +-
|
||||
src/libsystemd/sd-device/sd-device.c | 2 +-
|
||||
src/login/logind-dbus.c | 2 +-
|
||||
src/nspawn/nspawn-cgroup.c | 2 +-
|
||||
src/nspawn/nspawn.c | 6 +++---
|
||||
src/shared/cgroup-setup.c | 4 ++--
|
||||
src/sleep/sleep.c | 8 ++++----
|
||||
src/vconsole/vconsole-setup.c | 2 +-
|
||||
16 files changed, 33 insertions(+), 33 deletions(-)
|
||||
|
||||
diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
|
||||
index 50c1ae1b2b..5b40e92163 100644
|
||||
--- a/src/basic/cgroup-util.c
|
||||
+++ b/src/basic/cgroup-util.c
|
||||
@@ -765,7 +765,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
|
||||
|
||||
sc = strstrip(contents);
|
||||
if (isempty(sc)) {
|
||||
- r = write_string_file(fs, agent, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file(fs, agent, 0);
|
||||
if (r < 0)
|
||||
return r;
|
||||
} else if (!path_equal(sc, agent))
|
||||
@@ -783,7 +783,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
|
||||
|
||||
sc = strstrip(contents);
|
||||
if (streq(sc, "0")) {
|
||||
- r = write_string_file(fs, "1", WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file(fs, "1", 0);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@@ -810,7 +810,7 @@ int cg_uninstall_release_agent(const char *controller) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
- r = write_string_file(fs, "0", WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file(fs, "0", 0);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@@ -820,7 +820,7 @@ int cg_uninstall_release_agent(const char *controller) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
- r = write_string_file(fs, "", WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file(fs, "", 0);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@@ -1650,7 +1650,7 @@ int cg_set_attribute(const char *controller, const char *path, const char *attri
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
- return write_string_file(p, value, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ return write_string_file(p, value, 0);
|
||||
}
|
||||
|
||||
int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret) {
|
||||
diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c
|
||||
index 8f9eee8d36..480f8cc0b4 100644
|
||||
--- a/src/basic/procfs-util.c
|
||||
+++ b/src/basic/procfs-util.c
|
||||
@@ -86,13 +86,13 @@ int procfs_tasks_set_limit(uint64_t limit) {
|
||||
* decrease it, as threads-max is the much more relevant sysctl. */
|
||||
if (limit > pid_max-1) {
|
||||
sprintf(buffer, "%" PRIu64, limit+1); /* Add one, since PID 0 is not a valid PID */
|
||||
- r = write_string_file("/proc/sys/kernel/pid_max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file("/proc/sys/kernel/pid_max", buffer, 0);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
sprintf(buffer, "%" PRIu64, limit);
|
||||
- r = write_string_file("/proc/sys/kernel/threads-max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file("/proc/sys/kernel/threads-max", buffer, 0);
|
||||
if (r < 0) {
|
||||
uint64_t threads_max;
|
||||
|
||||
diff --git a/src/basic/smack-util.c b/src/basic/smack-util.c
|
||||
index 3362ee3924..80c0f2a52e 100644
|
||||
--- a/src/basic/smack-util.c
|
||||
+++ b/src/basic/smack-util.c
|
||||
@@ -114,7 +114,7 @@ int mac_smack_apply_pid(pid_t pid, const char *label) {
|
||||
return 0;
|
||||
|
||||
p = procfs_file_alloca(pid, "attr/current");
|
||||
- r = write_string_file(p, label, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file(p, label, 0);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
diff --git a/src/basic/sysctl-util.c b/src/basic/sysctl-util.c
|
||||
index c96b5cd77f..d2476d9665 100644
|
||||
--- a/src/basic/sysctl-util.c
|
||||
+++ b/src/basic/sysctl-util.c
|
||||
@@ -93,7 +93,7 @@ int sysctl_write_ip_property(int af, const char *ifname, const char *property, c
|
||||
|
||||
log_debug("Setting '%s' to '%s'", p, value);
|
||||
|
||||
- return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | 0);
|
||||
}
|
||||
|
||||
int sysctl_read(const char *property, char **ret) {
|
||||
diff --git a/src/basic/util.c b/src/basic/util.c
|
||||
index 955b18bd2a..6d89c90176 100644
|
||||
--- a/src/basic/util.c
|
||||
+++ b/src/basic/util.c
|
||||
@@ -234,7 +234,7 @@ void disable_coredumps(void) {
|
||||
if (detect_container() > 0)
|
||||
return;
|
||||
|
||||
- r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", 0);
|
||||
if (r < 0)
|
||||
log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m");
|
||||
}
|
||||
diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c
|
||||
index f6b72e0bae..e9fd4d06be 100644
|
||||
--- a/src/binfmt/binfmt.c
|
||||
+++ b/src/binfmt/binfmt.c
|
||||
@@ -48,7 +48,7 @@ static int delete_rule(const char *rule) {
|
||||
if (!fn)
|
||||
return log_oom();
|
||||
|
||||
- return write_string_file(fn, "-1", WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ return write_string_file(fn, "-1", 0);
|
||||
}
|
||||
|
||||
static int apply_rule(const char *rule) {
|
||||
@@ -56,7 +56,7 @@ static int apply_rule(const char *rule) {
|
||||
|
||||
(void) delete_rule(rule);
|
||||
|
||||
- r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, 0);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to add binary format: %m");
|
||||
|
||||
@@ -222,7 +222,7 @@ static int run(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
/* Flush out all rules */
|
||||
- (void) write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ (void) write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0);
|
||||
|
||||
STRV_FOREACH(f, files) {
|
||||
k = apply_file(*f, true);
|
||||
diff --git a/src/core/main.c b/src/core/main.c
|
||||
index 3ee8d0a869..ec36e3e80f 100644
|
||||
--- a/src/core/main.c
|
||||
+++ b/src/core/main.c
|
||||
@@ -1401,7 +1401,7 @@ static int bump_unix_max_dgram_qlen(void) {
|
||||
if (v >= DEFAULT_UNIX_MAX_DGRAM_QLEN)
|
||||
return 0;
|
||||
|
||||
- r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", WRITE_STRING_FILE_DISABLE_BUFFER, "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN);
|
||||
+ r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", 0, "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN);
|
||||
if (r < 0)
|
||||
return log_full_errno(IN_SET(r, -EROFS, -EPERM, -EACCES) ? LOG_DEBUG : LOG_WARNING, r,
|
||||
"Failed to bump AF_UNIX datagram queue length, ignoring: %m");
|
||||
@@ -1678,7 +1678,7 @@ static void initialize_core_pattern(bool skip_setup) {
|
||||
if (getpid_cached() != 1)
|
||||
return;
|
||||
|
||||
- r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, 0);
|
||||
if (r < 0)
|
||||
log_warning_errno(r, "Failed to write '%s' to /proc/sys/kernel/core_pattern, ignoring: %m", arg_early_core_pattern);
|
||||
}
|
||||
diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c
|
||||
index 8cc1696a4f..ab7b4ba2c3 100644
|
||||
--- a/src/core/smack-setup.c
|
||||
+++ b/src/core/smack-setup.c
|
||||
@@ -325,17 +325,17 @@ int mac_smack_setup(bool *loaded_policy) {
|
||||
}
|
||||
|
||||
#ifdef SMACK_RUN_LABEL
|
||||
- r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, 0);
|
||||
if (r < 0)
|
||||
log_warning_errno(r, "Failed to set SMACK label \"" SMACK_RUN_LABEL "\" on self: %m");
|
||||
- r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, 0);
|
||||
if (r < 0)
|
||||
log_warning_errno(r, "Failed to set SMACK ambient label \"" SMACK_RUN_LABEL "\": %m");
|
||||
r = write_string_file("/sys/fs/smackfs/netlabel",
|
||||
- "0.0.0.0/0 " SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ "0.0.0.0/0 " SMACK_RUN_LABEL, 0);
|
||||
if (r < 0)
|
||||
log_warning_errno(r, "Failed to set SMACK netlabel rule \"0.0.0.0/0 " SMACK_RUN_LABEL "\": %m");
|
||||
- r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", 0);
|
||||
if (r < 0)
|
||||
log_warning_errno(r, "Failed to set SMACK netlabel rule \"127.0.0.1 -CIPSO\": %m");
|
||||
#endif
|
||||
diff --git a/src/hibernate-resume/hibernate-resume.c b/src/hibernate-resume/hibernate-resume.c
|
||||
index 58e35e403e..1d0beb4008 100644
|
||||
--- a/src/hibernate-resume/hibernate-resume.c
|
||||
+++ b/src/hibernate-resume/hibernate-resume.c
|
||||
@@ -45,7 +45,7 @@ int main(int argc, char *argv[]) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
- r = write_string_file("/sys/power/resume", major_minor, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file("/sys/power/resume", major_minor, 0);
|
||||
if (r < 0) {
|
||||
log_error_errno(r, "Failed to write '%s' to /sys/power/resume: %m", major_minor);
|
||||
return EXIT_FAILURE;
|
||||
diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c
|
||||
index d82f01a164..b8fd63346c 100644
|
||||
--- a/src/libsystemd/sd-device/sd-device.c
|
||||
+++ b/src/libsystemd/sd-device/sd-device.c
|
||||
@@ -1987,7 +1987,7 @@ _public_ int sd_device_set_sysattr_value(sd_device *device, const char *sysattr,
|
||||
if (!value)
|
||||
return -ENOMEM;
|
||||
|
||||
- r = write_string_file(path, value, WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_NOFOLLOW);
|
||||
+ r = write_string_file(path, value, 0 | WRITE_STRING_FILE_NOFOLLOW);
|
||||
if (r < 0) {
|
||||
/* On failure, clear cache entry, as we do not know how it fails. */
|
||||
device_remove_cached_sysattr_value(device, sysattr);
|
||||
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
|
||||
index 3bc424b83b..5f5eef0843 100644
|
||||
--- a/src/login/logind-dbus.c
|
||||
+++ b/src/login/logind-dbus.c
|
||||
@@ -1330,7 +1330,7 @@ static int trigger_device(Manager *m, sd_device *d) {
|
||||
if (!t)
|
||||
return -ENOMEM;
|
||||
|
||||
- (void) write_string_file(t, "change", WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ (void) write_string_file(t, "change", 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
diff --git a/src/nspawn/nspawn-cgroup.c b/src/nspawn/nspawn-cgroup.c
|
||||
index cb01b25bc6..e92051268b 100644
|
||||
--- a/src/nspawn/nspawn-cgroup.c
|
||||
+++ b/src/nspawn/nspawn-cgroup.c
|
||||
@@ -124,7 +124,7 @@ int sync_cgroup(pid_t pid, CGroupUnified unified_requested, uid_t uid_shift) {
|
||||
fn = strjoina(tree, cgroup, "/cgroup.procs");
|
||||
|
||||
sprintf(pid_string, PID_FMT, pid);
|
||||
- r = write_string_file(fn, pid_string, WRITE_STRING_FILE_DISABLE_BUFFER|WRITE_STRING_FILE_MKDIR_0755);
|
||||
+ r = write_string_file(fn, pid_string, WRITE_STRING_FILE_MKDIR_0755);
|
||||
if (r < 0) {
|
||||
log_error_errno(r, "Failed to move process: %m");
|
||||
goto finish;
|
||||
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
|
||||
index 0c41a48d4b..9c893b18e4 100644
|
||||
--- a/src/nspawn/nspawn.c
|
||||
+++ b/src/nspawn/nspawn.c
|
||||
@@ -2695,7 +2695,7 @@ static int reset_audit_loginuid(void) {
|
||||
if (streq(p, "4294967295"))
|
||||
return 0;
|
||||
|
||||
- r = write_string_file("/proc/self/loginuid", "4294967295", WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file("/proc/self/loginuid", "4294967295", 0);
|
||||
if (r < 0) {
|
||||
log_error_errno(r,
|
||||
"Failed to reset audit login UID. This probably means that your kernel is too\n"
|
||||
@@ -3948,13 +3948,13 @@ static int setup_uid_map(pid_t pid) {
|
||||
|
||||
xsprintf(uid_map, "/proc/" PID_FMT "/uid_map", pid);
|
||||
xsprintf(line, UID_FMT " " UID_FMT " " UID_FMT "\n", 0, arg_uid_shift, arg_uid_range);
|
||||
- r = write_string_file(uid_map, line, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file(uid_map, line, 0);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to write UID map: %m");
|
||||
|
||||
/* We always assign the same UID and GID ranges */
|
||||
xsprintf(uid_map, "/proc/" PID_FMT "/gid_map", pid);
|
||||
- r = write_string_file(uid_map, line, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file(uid_map, line, 0);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to write GID map: %m");
|
||||
|
||||
diff --git a/src/shared/cgroup-setup.c b/src/shared/cgroup-setup.c
|
||||
index f197f715c7..077f893177 100644
|
||||
--- a/src/shared/cgroup-setup.c
|
||||
+++ b/src/shared/cgroup-setup.c
|
||||
@@ -267,7 +267,7 @@ int cg_attach(const char *controller, const char *path, pid_t pid) {
|
||||
|
||||
xsprintf(c, PID_FMT "\n", pid);
|
||||
|
||||
- r = write_string_file(fs, c, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file(fs, c, 0);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@@ -799,7 +799,7 @@ int cg_enable_everywhere(
|
||||
return log_debug_errno(errno, "Failed to open cgroup.subtree_control file of %s: %m", p);
|
||||
}
|
||||
|
||||
- r = write_string_stream(f, s, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_stream(f, s, 0);
|
||||
if (r < 0) {
|
||||
log_debug_errno(r, "Failed to %s controller %s for %s (%s): %m",
|
||||
FLAGS_SET(mask, bit) ? "enable" : "disable", n, p, fs);
|
||||
diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c
|
||||
index 262d4cea66..0523e8dc9b 100644
|
||||
--- a/src/sleep/sleep.c
|
||||
+++ b/src/sleep/sleep.c
|
||||
@@ -48,7 +48,7 @@ static int write_hibernate_location_info(const HibernateLocation *hibernate_loca
|
||||
assert(hibernate_location->swap);
|
||||
|
||||
xsprintf(resume_str, "%u:%u", major(hibernate_location->devno), minor(hibernate_location->devno));
|
||||
- r = write_string_file("/sys/power/resume", resume_str, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file("/sys/power/resume", resume_str, 0);
|
||||
if (r < 0)
|
||||
return log_debug_errno(r, "Failed to write partition device to /sys/power/resume for '%s': '%s': %m",
|
||||
hibernate_location->swap->device, resume_str);
|
||||
@@ -75,7 +75,7 @@ static int write_hibernate_location_info(const HibernateLocation *hibernate_loca
|
||||
}
|
||||
|
||||
xsprintf(offset_str, "%" PRIu64, hibernate_location->offset);
|
||||
- r = write_string_file("/sys/power/resume_offset", offset_str, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file("/sys/power/resume_offset", offset_str, 0);
|
||||
if (r < 0)
|
||||
return log_debug_errno(r, "Failed to write swap file offset to /sys/power/resume_offset for '%s': '%s': %m",
|
||||
hibernate_location->swap->device, offset_str);
|
||||
@@ -92,7 +92,7 @@ static int write_mode(char **modes) {
|
||||
STRV_FOREACH(mode, modes) {
|
||||
int k;
|
||||
|
||||
- k = write_string_file("/sys/power/disk", *mode, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ k = write_string_file("/sys/power/disk", *mode, 0);
|
||||
if (k >= 0)
|
||||
return 0;
|
||||
|
||||
@@ -114,7 +114,7 @@ static int write_state(FILE **f, char **states) {
|
||||
STRV_FOREACH(state, states) {
|
||||
int k;
|
||||
|
||||
- k = write_string_stream(*f, *state, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ k = write_string_stream(*f, *state, 0);
|
||||
if (k >= 0)
|
||||
return 0;
|
||||
log_debug_errno(k, "Failed to write '%s' to /sys/power/state: %m", *state);
|
||||
diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
|
||||
index d1c3febdd5..1cc68694d1 100644
|
||||
--- a/src/vconsole/vconsole-setup.c
|
||||
+++ b/src/vconsole/vconsole-setup.c
|
||||
@@ -116,7 +116,7 @@ static int toggle_utf8_vc(const char *name, int fd, bool utf8) {
|
||||
static int toggle_utf8_sysfs(bool utf8) {
|
||||
int r;
|
||||
|
||||
- r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), 0);
|
||||
if (r < 0)
|
||||
return log_warning_errno(r, "Failed to %s sysfs UTF-8 flag: %m", enable_disable(utf8));
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
From d73755cc60f401f0f20f357752e45aeeeef8e83f Mon Sep 17 00:00:00 2001
|
||||
From: Scott Murray <scott.murray@konsulko.com>
|
||||
Date: Fri, 13 Sep 2019 19:26:27 -0400
|
||||
Subject: [PATCH] Handle __cpu_mask usage
|
||||
|
||||
Fixes errors:
|
||||
|
||||
src/test/test-cpu-set-util.c:18:54: error: '__cpu_mask' undeclared (first use in this function)
|
||||
src/test/test-sizeof.c:73:14: error: '__cpu_mask' undeclared (first use in this function)
|
||||
|
||||
__cpu_mask is an internal type of glibc's cpu_set implementation, not
|
||||
part of the POSIX definition, which is problematic when building with
|
||||
musl, which does not define a matching type. From inspection of musl's
|
||||
sched.h, however, it is clear that the corresponding type would be
|
||||
unsigned long, which does match glibc's actual __CPU_MASK_TYPE. So,
|
||||
add a typedef to cpu-set-util.h defining __cpu_mask appropriately.
|
||||
|
||||
Upstream-Status: Inappropriate [musl specific]
|
||||
|
||||
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
|
||||
|
||||
---
|
||||
src/shared/cpu-set-util.h | 2 ++
|
||||
src/test/test-sizeof.c | 2 +-
|
||||
2 files changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/shared/cpu-set-util.h b/src/shared/cpu-set-util.h
|
||||
index 3c63a58826..4c2d4347fc 100644
|
||||
--- a/src/shared/cpu-set-util.h
|
||||
+++ b/src/shared/cpu-set-util.h
|
||||
@@ -6,6 +6,8 @@
|
||||
#include "macro.h"
|
||||
#include "missing_syscall.h"
|
||||
|
||||
+typedef unsigned long __cpu_mask;
|
||||
+
|
||||
/* This wraps the libc interface with a variable to keep the allocated size. */
|
||||
typedef struct CPUSet {
|
||||
cpu_set_t *set;
|
||||
diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c
|
||||
index e1a59d408c..c269ea6e8c 100644
|
||||
--- a/src/test/test-sizeof.c
|
||||
+++ b/src/test/test-sizeof.c
|
||||
@@ -1,6 +1,5 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
-#include <sched.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
@@ -10,6 +9,7 @@
|
||||
#include <float.h>
|
||||
|
||||
#include "time-util.h"
|
||||
+#include "cpu-set-util.h"
|
||||
|
||||
/* Print information about various types. Useful when diagnosing
|
||||
* gcc diagnostics on an unfamiliar architecture. */
|
|
@ -1,171 +0,0 @@
|
|||
From 04e94f9a15101daa8f65a9af269d26cda2a24056 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Kiernan <alex.kiernan@gmail.com>
|
||||
Date: Tue, 10 Mar 2020 11:05:20 +0000
|
||||
Subject: [PATCH] Handle missing gshadow
|
||||
|
||||
gshadow usage is now present in the userdb code. Mask all uses of it to
|
||||
allow compilation on musl
|
||||
|
||||
Upstream-Status: Inappropriate [musl specific]
|
||||
Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
|
||||
[Rebased for v247]
|
||||
Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
|
||||
|
||||
---
|
||||
src/shared/user-record-nss.c | 20 ++++++++++++++++++++
|
||||
src/shared/user-record-nss.h | 4 ++++
|
||||
src/shared/userdb.c | 6 ++++++
|
||||
3 files changed, 30 insertions(+)
|
||||
|
||||
diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c
|
||||
index 88b8fc2f8f..a819d41bac 100644
|
||||
--- a/src/shared/user-record-nss.c
|
||||
+++ b/src/shared/user-record-nss.c
|
||||
@@ -331,8 +331,10 @@ int nss_group_to_group_record(
|
||||
if (isempty(grp->gr_name))
|
||||
return -EINVAL;
|
||||
|
||||
+#if ENABLE_GSHADOW
|
||||
if (sgrp && !streq_ptr(sgrp->sg_namp, grp->gr_name))
|
||||
return -EINVAL;
|
||||
+#endif
|
||||
|
||||
g = group_record_new();
|
||||
if (!g)
|
||||
@@ -348,6 +350,7 @@ int nss_group_to_group_record(
|
||||
|
||||
g->gid = grp->gr_gid;
|
||||
|
||||
+#if ENABLE_GSHADOW
|
||||
if (sgrp) {
|
||||
if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) {
|
||||
g->hashed_password = strv_new(sgrp->sg_passwd);
|
||||
@@ -363,6 +366,7 @@ int nss_group_to_group_record(
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
+#endif
|
||||
|
||||
r = json_build(&g->json, JSON_BUILD_OBJECT(
|
||||
JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)),
|
||||
@@ -388,6 +392,7 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
|
||||
assert(ret_sgrp);
|
||||
assert(ret_buffer);
|
||||
|
||||
+#if ENABLE_GSHADOW
|
||||
for (;;) {
|
||||
_cleanup_free_ char *buf = NULL;
|
||||
struct sgrp sgrp, *result;
|
||||
@@ -416,6 +421,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
|
||||
buflen *= 2;
|
||||
buf = mfree(buf);
|
||||
}
|
||||
+#else
|
||||
+ return -ESRCH;
|
||||
+#endif
|
||||
}
|
||||
|
||||
int nss_group_record_by_name(
|
||||
@@ -427,7 +435,9 @@ int nss_group_record_by_name(
|
||||
struct group grp, *result;
|
||||
bool incomplete = false;
|
||||
size_t buflen = 4096;
|
||||
+#if ENABLE_GSHADOW
|
||||
struct sgrp sgrp, *sresult = NULL;
|
||||
+#endif
|
||||
int r;
|
||||
|
||||
assert(name);
|
||||
@@ -457,6 +467,7 @@ int nss_group_record_by_name(
|
||||
buf = mfree(buf);
|
||||
}
|
||||
|
||||
+#if ENABLE_GSHADOW
|
||||
if (with_shadow) {
|
||||
r = nss_sgrp_for_group(result, &sgrp, &sbuf);
|
||||
if (r < 0) {
|
||||
@@ -468,6 +479,9 @@ int nss_group_record_by_name(
|
||||
incomplete = true;
|
||||
|
||||
r = nss_group_to_group_record(result, sresult, ret);
|
||||
+#else
|
||||
+ r = nss_group_to_group_record(result, NULL, ret);
|
||||
+#endif
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@@ -484,7 +498,9 @@ int nss_group_record_by_gid(
|
||||
struct group grp, *result;
|
||||
bool incomplete = false;
|
||||
size_t buflen = 4096;
|
||||
+#if ENABLE_GSHADOW
|
||||
struct sgrp sgrp, *sresult = NULL;
|
||||
+#endif
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
@@ -512,6 +528,7 @@ int nss_group_record_by_gid(
|
||||
buf = mfree(buf);
|
||||
}
|
||||
|
||||
+#if ENABLE_GSHADOW
|
||||
if (with_shadow) {
|
||||
r = nss_sgrp_for_group(result, &sgrp, &sbuf);
|
||||
if (r < 0) {
|
||||
@@ -523,6 +540,9 @@ int nss_group_record_by_gid(
|
||||
incomplete = true;
|
||||
|
||||
r = nss_group_to_group_record(result, sresult, ret);
|
||||
+#else
|
||||
+ r = nss_group_to_group_record(result, NULL, ret);
|
||||
+#endif
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
diff --git a/src/shared/user-record-nss.h b/src/shared/user-record-nss.h
|
||||
index 22ab04d6ee..4e52e7a911 100644
|
||||
--- a/src/shared/user-record-nss.h
|
||||
+++ b/src/shared/user-record-nss.h
|
||||
@@ -2,7 +2,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <grp.h>
|
||||
+#if ENABLE_GSHADOW
|
||||
#include <gshadow.h>
|
||||
+#else
|
||||
+struct sgrp;
|
||||
+#endif
|
||||
#include <pwd.h>
|
||||
#include <shadow.h>
|
||||
|
||||
diff --git a/src/shared/userdb.c b/src/shared/userdb.c
|
||||
index 613350bd46..5c821d28cd 100644
|
||||
--- a/src/shared/userdb.c
|
||||
+++ b/src/shared/userdb.c
|
||||
@@ -938,13 +938,16 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
|
||||
if (gr) {
|
||||
_cleanup_free_ char *buffer = NULL;
|
||||
bool incomplete = false;
|
||||
+#if ENABLE_GSHADOW
|
||||
struct sgrp sgrp;
|
||||
+#endif
|
||||
|
||||
if (streq_ptr(gr->gr_name, "root"))
|
||||
iterator->synthesize_root = false;
|
||||
if (gr->gr_gid == GID_NOBODY)
|
||||
iterator->synthesize_nobody = false;
|
||||
|
||||
+#if ENABLE_GSHADOW
|
||||
if (!FLAGS_SET(iterator->flags, USERDB_AVOID_SHADOW)) {
|
||||
r = nss_sgrp_for_group(gr, &sgrp, &buffer);
|
||||
if (r < 0) {
|
||||
@@ -957,6 +960,9 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
|
||||
}
|
||||
|
||||
r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret);
|
||||
+#else
|
||||
+ r = nss_group_to_group_record(gr, NULL, ret);
|
||||
+#endif
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
From 366cd28f5f93ba7c861cd32a718251770d74830e Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Mon, 12 Apr 2021 23:44:53 -0700
|
||||
Subject: [PATCH] missing_syscall.h: Define MIPS ABI defines for musl
|
||||
|
||||
musl does not define _MIPS_SIM_ABI32, _MIPS_SIM_NABI32, _MIPS_SIM_ABI64
|
||||
unlike glibc where these are provided by libc headers, therefore define
|
||||
them here in case they are undefined
|
||||
|
||||
Upstream-Status: Pending
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
|
||||
---
|
||||
src/basic/missing_syscall.h | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/src/basic/missing_syscall.h b/src/basic/missing_syscall.h
|
||||
index 1384324804..0202d00372 100644
|
||||
--- a/src/basic/missing_syscall.h
|
||||
+++ b/src/basic/missing_syscall.h
|
||||
@@ -20,6 +20,12 @@
|
||||
#include <asm/sgidefs.h>
|
||||
#endif
|
||||
|
||||
+#ifndef _MIPS_SIM_ABI32
|
||||
+#define _MIPS_SIM_ABI32 1
|
||||
+#define _MIPS_SIM_NABI32 2
|
||||
+#define _MIPS_SIM_ABI64 3
|
||||
+#endif
|
||||
+
|
||||
#include "missing_keyctl.h"
|
||||
#include "missing_stat.h"
|
||||
#include "missing_syscall_def.h"
|
|
@ -219,31 +219,7 @@ src_prepare() {
|
|||
|
||||
if use elibc_musl; then
|
||||
PATCHES+=(
|
||||
"${FILESDIR}"/musl/0002-don-t-use-glibc-specific-qsort_r.patch
|
||||
"${FILESDIR}"/musl/0003-implment-systemd-sysv-install-for-OE.patch
|
||||
"${FILESDIR}"/musl/0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch
|
||||
"${FILESDIR}"/musl/0004-add-fallback-parse_printf_format-implementation.patch
|
||||
"${FILESDIR}"/musl/0005-src-basic-missing.h-check-for-missing-strndupa.patch
|
||||
"${FILESDIR}"/musl/0006-Include-netinet-if_ether.h.patch
|
||||
"${FILESDIR}"/musl/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch
|
||||
"${FILESDIR}"/musl/0008-add-missing-FTW_-macros-for-musl.patch
|
||||
"${FILESDIR}"/musl/0009-fix-missing-of-__register_atfork-for-non-glibc-build.patch
|
||||
"${FILESDIR}"/musl/0010-Use-uintmax_t-for-handling-rlim_t.patch
|
||||
"${FILESDIR}"/musl/0011-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch
|
||||
"${FILESDIR}"/musl/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch
|
||||
"${FILESDIR}"/musl/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch
|
||||
"${FILESDIR}"/musl/0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch
|
||||
"${FILESDIR}"/musl/0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch
|
||||
"${FILESDIR}"/musl/0016-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch
|
||||
"${FILESDIR}"/musl/0017-missing_type.h-add-__compar_d_fn_t-definition.patch
|
||||
"${FILESDIR}"/musl/0018-avoid-redefinition-of-prctl_mm_map-structure.patch
|
||||
"${FILESDIR}"/musl/0019-Handle-missing-LOCK_EX.patch
|
||||
"${FILESDIR}"/musl/0020-Fix-incompatible-pointer-type-struct-sockaddr_un.patch
|
||||
"${FILESDIR}"/musl/0021-test-json.c-define-M_PIl.patch
|
||||
"${FILESDIR}"/musl/0022-do-not-disable-buffer-in-writing-files.patch
|
||||
"${FILESDIR}"/musl/0025-Handle-__cpu_mask-usage.patch
|
||||
"${FILESDIR}"/musl/0026-Handle-missing-gshadow.patch
|
||||
"${FILESDIR}"/musl/0028-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch
|
||||
"${FILESDIR}"/musl/0001-Allow-building-on-musl-libc.patch
|
||||
)
|
||||
fi
|
||||
|
||||
|
@ -397,8 +373,10 @@ multilib_src_install_all() {
|
|||
rmdir "${ED}${rootprefix}"/sbin || die
|
||||
fi
|
||||
|
||||
if use elibc_glibc;then
|
||||
# https://bugs.gentoo.org/761763
|
||||
rm -r "${ED}"/usr/lib/sysusers.d || die
|
||||
fi
|
||||
|
||||
# Preserve empty dirs in /etc & /var, bug #437008
|
||||
keepdir /etc/{binfmt.d,modules-load.d,tmpfiles.d}
|
||||
|
|
Loading…
Reference in New Issue