On Wed, Jul 28, 2021 at 1:16 PM Seebs <se...@seebs.net> wrote: > > On Wed, 28 Jul 2021 11:36:22 +0200 > "Damian Wrobel" <dwro...@ertelnet.rybnik.pl> wrote: > > > Do I correctly assume that pseudo_client_op() has to be fully > > reentrant? > > No. It's never been even a tiny bit reentrant. We used to do the > allocate and free thing, and it was incredibly expensive, and the > nature of the thing requires confidence that we never, ever, have > more than one thing writing and reading over the socket at a time, > so it's just Not Reentrant. During one call to pseudo_client_op, > there will never be another, and all the IPC stuff uses a single > consistent local buffer that it returns the address of. > > Declaring that as static without changing the initializer would indeed > break everything -- we rely on the initializer working. Changing it to > static means it only gets initialized once... > > Changing it to: > > static pseudo_msg_t msg; > msg = pseudo_msg_t { .type = PSEUDO_MSG_OP }; > > would probably be fine, because then it'd be initialized. Otherwise, > we'd get failures when msg got overwritten and reused. > > Or just changing `result = &msg` to something like `result = > &xattrdb_data`, which would be nonsensical but it turns out not to > matter, as the only caller that reaches this case is the caller > that's just checking yes/no "is the return value not a null pointer".
If the caller only cares about yes/no then how about returning 1/0 instead of a pointer?
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#154218): https://lists.openembedded.org/g/openembedded-core/message/154218 Mute This Topic: https://lists.openembedded.org/mt/84479678/21656 Group Owner: openembedded-core+ow...@lists.openembedded.org Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-