summaryrefslogtreecommitdiff
path: root/libmachdev
AgeCommit message (Collapse)Author
2025-02-08Add names to threadsSamuel Thibault
2024-12-23Fix port leaksSamuel Thibault
get_privileged_ports adds a port ref, so we have to deallocate it.
2024-12-14Add a description comment for the MIG type translation filesZhaoming Luo
Signed-off-by: Zhaoming Luo <zhmingluo@163.com> Message-ID: <20241213005831.748151-1-zhmingluo@163.com>
2024-11-10acpi, libmachdev: Add _forever variant of trivfs server loopDamien Zammit via Bug reports for the GNU Hurd
The acpi server needs to survive after the shutdown notification, so it can serve S_acpi_sleep() RPC to actually shut down the machine. Therefore we need to keep the server alive and not respond to the trivfs goaway request. Message-ID: <20241110084135.3859485-2-damien@zamaudio.com>
2024-09-10Define i386_get_xstate_size in libmachdev.Flavio Cruz
libmachdev implements the mach_i386 routines, so we have to implement this one. Message-ID: <3pe32mbui3x3gueiyk5ybzrj54gkbwddlk6kqjconwg7jnxlc6@kgsaffiftak2>
2024-08-25Fix line-buffered stderrSamuel Thibault
mach_open_devstream creates a fully-buffered stream by default. This prevents from seeing various messages.
2023-12-17Update server handlers to return kern_return_error to fix ↵v0.9.git20231217Flavio Cruz
-Werror=enum-int-mismatch warnings MiG expects those to return kern_return_t. Message-ID: <ZXqbbXpVqQAwd2qv@jupiter.tail36e24.ts.net>
2023-05-10libmachdev: Port to x86_64Sergey Bugaev
Message-Id: <20230508213136.608575-14-bugaevc@gmail.com>
2023-05-07Implement device_open_new for all the translators implementing the device ↵Flavio Cruz
interface. Message-Id: <ZFfcloxDKSiyHJTH@jupiter.tail36e24.ts.net>
2023-05-02Use uintptr_t for message payloads.Flavio Cruz
A follow up to 92fad38a043b75ed6b435b3efa574ede91dbe9ee in gnumach. Message-Id: <ZFCNasf9bJ9qj+CG@jupiter.tail36e24.ts.net>
2023-04-03Modernize code by removing use of old style definitions.Flavio Cruz
Also add -Werror=old-style-definition to enforce new code. Message-Id: <ZBZ+8xf7GHy2RT/h@jupiter.tail36e24.ts.net>
2023-01-01Do not ignore value returned by get_privileged_portsSamuel Thibault
2022-09-11machdev, pci-arbiter, rumpdisk: Fix race condition in bootstrapDamien Zammit
This fixes a known race condition in bootstrapping by separating the fsys_startup call from the server demuxer loop into two separate functions that the caller can decide when to call. Message-Id: <20220908093229.499494-1-damien@zamaudio.com>
2022-08-10Fix including notify_S.h and running ports_notify_server_routineSamuel Thibault
2022-08-10libmachdev: Use notify server implementation from libportsSergey Bugaev
Since the implementation in libmachdev was just forwarding calls to the corresponding libports functions, we might as well just use ports_notify_server_routine () directly.
2022-03-01libmachdev: Export demuxer as machdev_demuxer and bucket pointerDamien Zammit
This will allow callers to manage their own server routine. Message-Id: <20220227091013.33112-3-damien@zamaudio.com>
2022-03-01libmachdev: No-op fix styling of functionsDamien Zammit
Message-Id: <20220227091013.33112-2-damien@zamaudio.com>
2022-02-20libmachdev: Register translator for shutdown notificationSamuel Thibault
When starting a libmachdev translator after bootstrap, we still want the translator to be notified by startup, to properly flush buffers etc.
2022-02-12Fix warningSamuel Thibault
libmachdev/ds_routines.c (ds_device_write_inband): Replace const_io_buf_ptr_inband_t with const io_buf_ptr_inband_t, as generated by mig.
2022-01-16Make RPC input array parameters constSamuel Thibault
This follows mig's cf4bcc3f1435 ("Also add const qualifiers on server side")
2022-01-01Fix build warningsSamuel Thibault
No actual behavior change.
2021-08-11libmachdev: Fix startup_dosyncSamuel Thibault
We do not actually want to shut everything down. For instance, we still have to be able to start the acpi translator to perform the actual shutdown. What we however have to do is syncing the disks.
2021-08-11bootstrap: Fix passing proc server from FS to rumpdiskSamuel Thibault
libdiskfs was passing its own proc port, thus confusing the fsys_init call in rumpdisk.
2021-07-11Fix /proc/?/exe values for bootstrap processesDamien Zammit
This makes libmachdev follow the exec case, and make sure to be waiting for all bootstrap processes by waiting for the FS process. Message-Id: <20210711012042.77920-1-damien@zamaudio.com>
2021-04-15libmachdev: Restore making machdev_trivfs_server blockingSamuel Thibault
netdde actually needs to control which thread runs the trivfs server, for managing per-thread state etc. Only pci-arbiter needs to run machdev_trivfs_server non-blockingly, it can create a thread by itself. * libmachdev/trivfs_server.c (machdev_trivfs_loop): Move back muxer loop to... (machdev_trivfs_server): ... here. * pci-arbiter/main.c (main): Run machdev_trivfs_server in its own thread. * rumpdisk/main.c (main): Do not call pthread_exit().
2021-04-14Fix typoSamuel Thibault
* libmachdev/trivfs_server.c (trivfs_S_fsys_init): Pass machdev_argv to _hurd_libc_proc_init, not diskfs_argv.
2021-04-11Call _hurd_libc_proc_init when availableSamuel Thibault
glibc 2.33 separated out _hurd_libc_proc_init from _hurd_init, so we have to additionally call it. * configure.ac (_hurd_libc_proc_init): Detect function. * libdiskfs/boot-start.c (diskfs_S_fsys_init): Call _hurd_libc_proc_init. * libmachdev/trivfs_server.c (trivfs_S_fsys_init): Call _hurd_libc_proc_init.
2021-04-04libmachdev: Fix non-bootstrap translator startupSamuel Thibault
* libmachdev/trivfs_server.c (machdev_trivfs_init): Call fsys_getpriv only when bootstrapping.
2021-04-04machdev: Pass argv through to _hurd_initv0.9.git20210404Damien Zammit
Message-Id: <20210404033750.143411-1-damien@zamaudio.com>
2021-03-19machdev: Fix parent proc passthrough in fsys_initDamien Zammit
* libmachdev/trivfs_server.c (parent_task): New global variable. (machdev_trivfs_init): Remove parent_task local variable. (trivfs_S_fsys_init): Pass parent's proc port to fsys_init call. Accept EPERM error from proc_mark_important for bootstrap case. Check errors from proc_set_exe call. Message-Id: <20210319021512.823541-1-damien@zamaudio.com>
2021-03-16machdev,rump,pci: Rework bootstrapDamien Zammit
* libmachdev/trivfs_server.c (bootstrapped): Rename to bootstrapping. (trivfs_S_fsys_startup): Call fsys_startup on the bootstrap port. (essential_task): New function. (trivfs_S_fsys_init): Call fsys_init on the bootstrap port. Configure proc. Mark us as essential when bootstrapping even without a devnode. (arrange_shutdown_notification): Do not configure proc. (machdev_trivfs_init): Always get the bootstrap port from the kernel, leave it MACH_PORT_NULL if unavailable. Call fsys_getpriv on it if it is. * pci-arbiter/Makefile (SRCS): Remove startup.c. * pci-arbiter/startup.c: Delete file. * pci-arbiter/startup.h: Delete file. * pci-arbiter/main.c: Do not include "startup.h" (pci_device_shutdown): Do not try to lokup the dosync_handle. (pcifs_startup): Always create the pci_control_port right on the control port. (main): Call machdev_device_init after machdev_trivfs_init. Do not call arrange_shutdown_notification. * rumpdisk/main.c (netfs_server_name): Don't pretend to be the arbiter anymore (main): Call machdev_device_init after machdev_trivfs_init. Message-Id: <20210316054715.788725-1-damien@zamaudio.com>
2021-03-07libmachdev: pass shutdown handle to shutdown methodDamien Zammit
* libmachdev/machdev-device_emul.h (struct machdev_device_emulation_ops): Add shutdown method. * libmachdev/ds_routines.c (machdev_device_shutdown): Take dosync_handle handle and pass it to shutdown method. * libmachdev/machdev.h (machdev_device_shutdown): Update prototype. * libmachdev/trivfs_server.c (S_startup_dosync): Pass shutdown handle to machdev_device_shutdown call. * rumpdisk/block-rump.c (rumpdisk_device_shutdown): Take dosync_handle parameter.
2021-03-02libmachdev: Spawn a thread for server loop so main pathway can continueDamien Zammit
Message-Id: <20210302114137.592230-3-damien@zamaudio.com>
2020-11-15libmachdev: Fix spurious send referenceSamuel Thibault
* libmachdev/trivfs_server.c (trivfs_S_fsys_getpriv): Move the just-copied send rights instead of copying them again.
2020-11-15libmachdev: Make comments more preciseSamuel Thibault
2020-11-15libmachdev: Fix warningSamuel Thibault
* libmachdev/trivfs_server.c: Include <mach/i386/mach_i386.h>.
2020-11-15libmachdev: Remove duplicate declarationSamuel Thibault
* libmachdev/ds_routines.c (machdev_is_master_device): Remove duplicate declaration.
2020-11-15libmachdev: Fix missing backtranslation to port nameSamuel Thibault
trivfs happens to set the payload for our control port, and we are not using payload translation for mach_i386, so we need to tell mig how to get back to the port name. * libmachdev/Makefile (mach_i386-MIGSFLAGS): Set -DMACH_PAYLOAD_TO_PORT=ports_payload_get_name.
2020-11-14libmachdev: Avoid conflating translator name and pathSamuel Thibault
bootstrap translators may not wish to appear in the FS, and the name of the translator does not have to match the path where it is getting installed. * libmachdev/machdev.h (machdev_trivfs_init): Add path parameter. * libmachdev/trivfs_server.c (machdev_trivfs_init): Add path parameter, set devnode only if it is not NULL. (trivfs_S_fsys_init): Only call install_as_translator when devnode is not NULL. * /rumpdisk/main.c (main): Add path parameter.
2020-11-14libmachdev: Support installing translator in the FSDamien Zammit
*/libmachdev/trivfs_server.c (machdev_ctl): Rename to control_port. (trivfs_S_fsys_init): Fix accordingly. (control): New variable. (bootstrapped, underlying, devnode): New variables. (install_as_translator): New function. (trivfs_S_fsys_init): When bootstrapping, call install_as_translator. (machdev_trivfs_init): Create one port of the control class. (trivfs_S_fsys_getpriv): Use ports_get_send_right on the control port instead of creating another one. (resume_bootstrap_server): Use ports_get_send_right on the control port instead of creating another one. (machdev_trivfs_init): When bootstrapping, Use our control port as fsys.
2020-09-06libmachdev: Remove declaration for static functionDamien Zammit
This one-liner fixes libmachdev build failure. Message-Id: <20200906020837.329023-1-damien@zamaudio.com>
2020-08-02libmachdev: Introduce startup notification for clean rumpdisk shutdownDamien Zammit
Message-Id: <20200801050538.273196-1-damien@zamaudio.com>
2020-07-25libmachdev: simplify source codeSamuel Thibault
* libmachdev/trivfs_server.c (machdev_is_master_device): Simplify source code.
2020-07-25libmachdev: Implement S_i386_io_perm_createDamien Zammit
Now that machdev redirects the device master port, it has to implement the i386 permission RPCs on it. Message-Id: <20200725011847.186969-2-damien@zamaudio.com> Message-Id: <20200725011847.186969-3-damien@zamaudio.com>
2020-07-25libmachdev: Add resume for bootstrap serverDamien Zammit
machdev users can now pass along a port to the next translator in the bootstrap chain (bootstrap_resume_task), that they'll get from their command line set by the bootloader. machdev will then call task_resume on it as appropriate. It will also have the opportunity to get fsys_getpriv calls, and thus redirect the device master port, thus having the opportunity to expose its devices on the device master port, as if they were handled by the kernel. Message-Id: <20200725011847.186969-1-damien@zamaudio.com>
2020-07-24libmachdev: Remove deviceUser, this lib is a deviceServerDamien Zammit
libmachuser provides what we need Message-Id: <20200724132039.110421-1-damien@zamaudio.com>
2020-07-18libmachdev: Add new RPC server stubs for ds_device_intr_*Damien Zammit
2020-03-30machdev: Expose machdev_emul_device structureSamuel Thibault
* libmachdev/machdev-dev_hdr.h (DEVICE_NULL): Remove macro. (emul_device): Rename structure to machdev_emul_device. (emul_device_t): Rename type to machdev_emul_device_t. (mach_device, mach_device_t, MACH_DEVICE_NULL): Move to... * libmachdev/mach_device.h: ... new file. * libmachdev/ds_routines.c: Include "mach_device.h". * libmachdev/machdev-device_emul.h: Include <mach/notify.h>, <device/device_types.h>, <device/net_status.h>, <errno.h> * libmachdev/machdev.h: Include "machdev_hdr.h". * libmachdev/mig-decls.h: Include "mach_device.h". * libmachdev/Makefile (LCLHDRS): Add mach_device.h. (installhdrs): Add machdev-dev_hdr.h.
2020-03-29libmachdev: Add common machdevZheng Da
* libmachdev: New directory.