configure: Fix atomic64 test for --enable-werror on macOS
[qemu/ar7.git] / chardev / chardev-sysemu.c
blobeecdc615ee1c6c64060452ac837d129fb83b12f0
1 /*
2 * QEMU System Emulator
4 * Copyright (c) 2003-2008 Fabrice Bellard
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
25 #include "qemu/osdep.h"
26 #include "sysemu/sysemu.h"
27 #include "chardev/char.h"
28 #include "qemu/error-report.h"
29 #include "chardev-internal.h"
31 static int chardev_machine_done_notify_one(Object *child, void *opaque)
33 Chardev *chr = (Chardev *)child;
34 ChardevClass *class = CHARDEV_GET_CLASS(chr);
36 if (class->chr_machine_done) {
37 return class->chr_machine_done(chr);
40 return 0;
43 static void chardev_machine_done_hook(Notifier *notifier, void *unused)
45 int ret = object_child_foreach(get_chardevs_root(),
46 chardev_machine_done_notify_one, NULL);
48 if (ret) {
49 error_report("Failed to call chardev machine_done hooks");
50 exit(1);
55 static Notifier chardev_machine_done_notify = {
56 .notify = chardev_machine_done_hook,
59 static void register_types(void)
62 * This must be done after machine init, since we register FEs with muxes
63 * as part of realize functions like serial_isa_realizefn when -nographic
64 * is specified.
66 qemu_add_machine_init_done_notifier(&chardev_machine_done_notify);
69 type_init(register_types);