[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 1/3] tools/libs/evtchn: decouple more from mini-os
On 12.01.22 08:22, Juergen Gross wrote:
On 11.01.22 20:56, Andrew Cooper wrote:
On 11/01/2022 15:03, Juergen Gross wrote:
diff --git a/tools/libs/evtchn/minios.c b/tools/libs/evtchn/minios.c
index e5dfdc5ef5..c3a5ce3b98 100644
--- a/tools/libs/evtchn/minios.c
+++ b/tools/libs/evtchn/minios.c
int osdep_evtchn_open(xenevtchn_handle *xce, unsigned int flags)
{
- int fd = alloc_fd(FTYPE_EVTCHN);
+ int fd;
+ struct file *file;
+ struct port_list *list;
+ static unsigned int ftype_evtchn;
- if ( fd == -1 )
+ if ( !ftype_evtchn )
+ ftype_evtchn = alloc_file_type(&evtchn_ops);
Hmm. MiniOS doesn't appear to support __attribute__((constructor)) but
this would be an ideal candidate.
It would remove a non-threadsafe singleton from a (largely unrelated)
codepath.
Should be very simple to add to MiniOS. See Xen's init_constructors(),
and add CONSTRUCTORS to the linker file.
I'll look into this.
Turns out that I can't use __attribute__((constructor)), as this is
supported through newlib already (the linker script contains everything
needed, but the activation is outside of Mini-OS).
I'll use something like initcall() instead.
Juergen
Attachment:
OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key
Attachment:
OpenPGP_signature
Description: OpenPGP digital signature
|