mirror of
https://github.com/qemu/qemu.git
synced 2024-11-24 03:13:44 +08:00
trivial patches for 2014-11-02
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQEcBAABAgAGBQJUVhuDAAoJEL7lnXSkw9fbOKMIAIE3XZMhar4Vmokb/K0DFbnh gy2z7iCe7vumLKiRSJX1LGmkFO3dwykw82JZQ1SVo0RdgguJ5dx1Abx1qDM1rojL jJT0pJ9zWPl4fTv38wCEfaysQHPdgwoH4826ga+MXnVS9XHRHHxuQ4vI01AK3oyQ 4t6/wto9H8kF3n6ny7tz5WNZClsq7qbiIqw5nNCILQfSh/VBPwxQNBiWf/nYVMuY Ubk5noztZwH+hbiAQL5lAPz/HolcRwg1tzbR0dfmt8/aqO28rJhasG58JgtziI2y JSg4BwldqUQEgiHonArLfQDixjLtEEyL+fQSzZm02ixwcBpc/ADSyGDy2R1zpH8= =j1ga -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/mjt/tags/pull-trivial-patches-2014-11-02' into staging trivial patches for 2014-11-02 # gpg: Signature made Sun 02 Nov 2014 11:54:43 GMT using RSA key ID A4C3D7DB # gpg: Good signature from "Michael Tokarev <mjt@tls.msk.ru>" # gpg: aka "Michael Tokarev <mjt@corpit.ru>" # gpg: aka "Michael Tokarev <mjt@debian.org>" * remotes/mjt/tags/pull-trivial-patches-2014-11-02: (23 commits) vdi: wrapped uuid_unparse() in #ifdef tap: fix possible fd leak in net_init_tap tap: do not close(fd) in net_init_tap_one target-i386: Remove unused model_features_t struct tap_int.h: remove repeating NETWORK_SCRIPT defines os-posix: reorder parent notification for -daemonize pidfile: stop making pidfile error a special case os-posix: replace goto again with a proper loop os-posix: use global daemon_pipe instead of cryptic fds[1] dump: Fix dump-guest-memory termination and use-after-close virtio-9p-proxy: improve error messages in connect_namedsocket() virtio-9p-proxy: fix error return in proxy_init() virtio-9p-proxy: Fix sockfd leak target-tricore: check return value before using it net/slirp: specify logbase for smbd Revert "os-posix: report error message when lock file failed" util: Improve os_mem_prealloc error message sparse: fix build target-arm: A64: remove redundant store target-xtensa: mark XtensaConfig structs as unused ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
7135781f65
@ -137,12 +137,14 @@ static inline int uuid_is_null(const uuid_t uu)
|
||||
return memcmp(uu, null_uuid, sizeof(uuid_t)) == 0;
|
||||
}
|
||||
|
||||
# if defined(CONFIG_VDI_DEBUG)
|
||||
static inline void uuid_unparse(const uuid_t uu, char *out)
|
||||
{
|
||||
snprintf(out, 37, UUID_FMT,
|
||||
uu[0], uu[1], uu[2], uu[3], uu[4], uu[5], uu[6], uu[7],
|
||||
uu[8], uu[9], uu[10], uu[11], uu[12], uu[13], uu[14], uu[15]);
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
|
1
configure
vendored
1
configure
vendored
@ -4908,6 +4908,7 @@ echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
|
||||
echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
|
||||
if test "$sparse" = "yes" ; then
|
||||
echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
|
||||
echo "CXX := REAL_CC=\"\$(CXX)\" cgcc" >> $config_host_mak
|
||||
echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
|
||||
echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
|
||||
fi
|
||||
|
11
dump.c
11
dump.c
@ -604,10 +604,9 @@ static void dump_iterate(DumpState *s, Error **errp)
|
||||
{
|
||||
GuestPhysBlock *block;
|
||||
int64_t size;
|
||||
int ret;
|
||||
Error *local_err = NULL;
|
||||
|
||||
while (1) {
|
||||
do {
|
||||
block = s->next_block;
|
||||
|
||||
size = block->target_end - block->target_start;
|
||||
@ -623,11 +622,9 @@ static void dump_iterate(DumpState *s, Error **errp)
|
||||
return;
|
||||
}
|
||||
|
||||
ret = get_next_block(s, block);
|
||||
if (ret == 1) {
|
||||
dump_completed(s);
|
||||
}
|
||||
}
|
||||
} while (!get_next_block(s, block));
|
||||
|
||||
dump_completed(s);
|
||||
}
|
||||
|
||||
static void create_vmcore(DumpState *s, Error **errp)
|
||||
|
@ -1104,14 +1104,15 @@ static int connect_namedsocket(const char *path)
|
||||
|
||||
sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
if (sockfd < 0) {
|
||||
fprintf(stderr, "socket %s\n", strerror(errno));
|
||||
fprintf(stderr, "failed to create socket: %s\n", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
strcpy(helper.sun_path, path);
|
||||
helper.sun_family = AF_UNIX;
|
||||
size = strlen(helper.sun_path) + sizeof(helper.sun_family);
|
||||
if (connect(sockfd, (struct sockaddr *)&helper, size) < 0) {
|
||||
fprintf(stderr, "socket error\n");
|
||||
fprintf(stderr, "failed to connect to %s: %s\n", path, strerror(errno));
|
||||
close(sockfd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1154,10 +1155,12 @@ static int proxy_init(FsContext *ctx)
|
||||
sock_id = atoi(ctx->fs_root);
|
||||
if (sock_id < 0) {
|
||||
fprintf(stderr, "socket descriptor not initialized\n");
|
||||
g_free(proxy);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (sock_id < 0) {
|
||||
g_free(proxy);
|
||||
return -1;
|
||||
}
|
||||
g_free(ctx->fs_root);
|
||||
ctx->fs_root = NULL;
|
||||
|
||||
|
@ -71,11 +71,11 @@ static void tricore_testboard_init(MachineState *machine, int board_id)
|
||||
machine->cpu_model = "tc1796";
|
||||
}
|
||||
cpu = cpu_tricore_init(machine->cpu_model);
|
||||
env = &cpu->env;
|
||||
if (!cpu) {
|
||||
error_report("Unable to find CPU definition");
|
||||
exit(1);
|
||||
}
|
||||
env = &cpu->env;
|
||||
memory_region_init_ram(ext_cram, NULL, "powerlink_ext_c.ram", 2*1024*1024, &error_abort);
|
||||
vmstate_register_ram_global(ext_cram);
|
||||
memory_region_init_ram(ext_dram, NULL, "powerlink_ext_d.ram", 4*1024*1024, &error_abort);
|
||||
|
@ -357,7 +357,6 @@ char *qemu_find_file(int type, const char *name);
|
||||
void os_setup_early_signal_handling(void);
|
||||
char *os_find_datadir(void);
|
||||
void os_parse_cmd_args(int index, const char *optarg);
|
||||
void os_pidfile_error(void);
|
||||
|
||||
/* Convert a byte between binary and BCD. */
|
||||
static inline uint8_t to_bcd(uint8_t val)
|
||||
|
@ -12,7 +12,11 @@
|
||||
#ifndef BITMAP_H
|
||||
#define BITMAP_H
|
||||
|
||||
#include "qemu-common.h"
|
||||
#include <glib.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/bitops.h"
|
||||
|
||||
/*
|
||||
|
@ -12,7 +12,9 @@
|
||||
#ifndef BITOPS_H
|
||||
#define BITOPS_H
|
||||
|
||||
#include "qemu-common.h"
|
||||
#include <stdint.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "host-utils.h"
|
||||
|
||||
#define BITS_PER_BYTE CHAR_BIT
|
||||
|
@ -549,8 +549,8 @@ static int slirp_smb(SlirpState* s, const char *exported_dir,
|
||||
);
|
||||
fclose(f);
|
||||
|
||||
snprintf(smb_cmdline, sizeof(smb_cmdline), "%s -s %s",
|
||||
CONFIG_SMBD_COMMAND, smb_conf);
|
||||
snprintf(smb_cmdline, sizeof(smb_cmdline), "%s -l %s -s %s",
|
||||
CONFIG_SMBD_COMMAND, s->smb_dir, smb_conf);
|
||||
|
||||
if (slirp_add_exec(s->slirp, 0, smb_cmdline, &vserver_addr, 139) < 0 ||
|
||||
slirp_add_exec(s->slirp, 0, smb_cmdline, &vserver_addr, 445) < 0) {
|
||||
|
@ -598,7 +598,6 @@ static int net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer,
|
||||
|
||||
s = net_tap_fd_init(peer, model, name, fd, vnet_hdr);
|
||||
if (!s) {
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -797,6 +796,7 @@ int net_init_tap(const NetClientOptions *opts, const char *name,
|
||||
if (net_init_tap_one(tap, peer, "bridge", name, ifname,
|
||||
script, downscript, vhostfdname,
|
||||
vnet_hdr, fd)) {
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
@ -824,6 +824,7 @@ int net_init_tap(const NetClientOptions *opts, const char *name,
|
||||
if (queues > 1 && i == 0 && !tap->has_ifname) {
|
||||
if (tap_fd_get_ifname(fd, ifname)) {
|
||||
error_report("Fail to get ifname");
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -832,6 +833,7 @@ int net_init_tap(const NetClientOptions *opts, const char *name,
|
||||
i >= 1 ? "no" : script,
|
||||
i >= 1 ? "no" : downscript,
|
||||
vhostfdname, vnet_hdr, fd)) {
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -29,9 +29,6 @@
|
||||
#include "qemu-common.h"
|
||||
#include "qapi-types.h"
|
||||
|
||||
#define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup"
|
||||
#define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown"
|
||||
|
||||
int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
|
||||
int vnet_hdr_required, int mq_required);
|
||||
|
||||
|
66
os-posix.c
66
os-posix.c
@ -47,7 +47,7 @@
|
||||
static struct passwd *user_pwd;
|
||||
static const char *chroot_dir;
|
||||
static int daemonize;
|
||||
static int fds[2];
|
||||
static int daemon_pipe;
|
||||
|
||||
void os_setup_early_signal_handling(void)
|
||||
{
|
||||
@ -205,6 +205,7 @@ void os_daemonize(void)
|
||||
{
|
||||
if (daemonize) {
|
||||
pid_t pid;
|
||||
int fds[2];
|
||||
|
||||
if (pipe(fds) == -1) {
|
||||
exit(1);
|
||||
@ -217,26 +218,21 @@ void os_daemonize(void)
|
||||
|
||||
close(fds[1]);
|
||||
|
||||
again:
|
||||
len = read(fds[0], &status, 1);
|
||||
if (len == -1 && (errno == EINTR)) {
|
||||
goto again;
|
||||
}
|
||||
if (len != 1) {
|
||||
exit(1);
|
||||
}
|
||||
else if (status == 1) {
|
||||
fprintf(stderr, "Could not acquire pidfile\n");
|
||||
exit(1);
|
||||
} else {
|
||||
exit(0);
|
||||
}
|
||||
} else if (pid < 0) {
|
||||
exit(1);
|
||||
}
|
||||
do {
|
||||
len = read(fds[0], &status, 1);
|
||||
} while (len < 0 && errno == EINTR);
|
||||
|
||||
/* only exit successfully if our child actually wrote
|
||||
* a one-byte zero to our pipe, upon successful init */
|
||||
exit(len == 1 && status == 0 ? 0 : 1);
|
||||
|
||||
} else if (pid < 0) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
close(fds[0]);
|
||||
qemu_set_cloexec(fds[1]);
|
||||
daemon_pipe = fds[1];
|
||||
qemu_set_cloexec(daemon_pipe);
|
||||
|
||||
setsid();
|
||||
|
||||
@ -259,17 +255,6 @@ void os_setup_post(void)
|
||||
int fd = 0;
|
||||
|
||||
if (daemonize) {
|
||||
uint8_t status = 0;
|
||||
ssize_t len;
|
||||
|
||||
again1:
|
||||
len = write(fds[1], &status, 1);
|
||||
if (len == -1 && (errno == EINTR)) {
|
||||
goto again1;
|
||||
}
|
||||
if (len != 1) {
|
||||
exit(1);
|
||||
}
|
||||
if (chdir("/")) {
|
||||
perror("not able to chdir to /");
|
||||
exit(1);
|
||||
@ -284,23 +269,22 @@ void os_setup_post(void)
|
||||
change_process_uid();
|
||||
|
||||
if (daemonize) {
|
||||
uint8_t status = 0;
|
||||
ssize_t len;
|
||||
|
||||
dup2(fd, 0);
|
||||
dup2(fd, 1);
|
||||
dup2(fd, 2);
|
||||
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
|
||||
void os_pidfile_error(void)
|
||||
{
|
||||
if (daemonize) {
|
||||
uint8_t status = 1;
|
||||
if (write(fds[1], &status, 1) != 1) {
|
||||
perror("daemonize. Writing to pipe\n");
|
||||
do {
|
||||
len = write(daemon_pipe, &status, 1);
|
||||
} while (len < 0 && errno == EINTR);
|
||||
if (len != 1) {
|
||||
exit(1);
|
||||
}
|
||||
} else
|
||||
fprintf(stderr, "Could not acquire pid file: %s\n", strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
void os_set_line_buffering(void)
|
||||
@ -319,8 +303,6 @@ int qemu_create_pidfile(const char *filename)
|
||||
return -1;
|
||||
}
|
||||
if (lockf(fd, F_TLOCK, 0) == -1) {
|
||||
fprintf(stderr, "lock file '%s' failed: %s\n",
|
||||
filename, strerror(errno));
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
@ -104,11 +104,6 @@ void os_parse_cmd_args(int index, const char *optarg)
|
||||
return;
|
||||
}
|
||||
|
||||
void os_pidfile_error(void)
|
||||
{
|
||||
fprintf(stderr, "Could not acquire pid file: %s\n", strerror(errno));
|
||||
}
|
||||
|
||||
int qemu_create_pidfile(const char *filename)
|
||||
{
|
||||
char buffer[128];
|
||||
|
@ -748,7 +748,6 @@ static void do_fp_st(DisasContext *s, int srcidx, TCGv_i64 tcg_addr, int size)
|
||||
} else {
|
||||
TCGv_i64 tcg_hiaddr = tcg_temp_new_i64();
|
||||
tcg_gen_qemu_st_i64(tmp, tcg_addr, get_mem_index(s), MO_TEQ);
|
||||
tcg_gen_qemu_st64(tmp, tcg_addr, get_mem_index(s));
|
||||
tcg_gen_ld_i64(tmp, cpu_env, fp_reg_hi_offset(s, srcidx));
|
||||
tcg_gen_addi_i64(tcg_hiaddr, tcg_addr, 8);
|
||||
tcg_gen_qemu_st_i64(tmp, tcg_hiaddr, get_mem_index(s), MO_TEQ);
|
||||
|
@ -442,14 +442,6 @@ const char *get_register_name_32(unsigned int reg)
|
||||
return x86_reg_info_32[reg].name;
|
||||
}
|
||||
|
||||
/* collects per-function cpuid data
|
||||
*/
|
||||
typedef struct model_features_t {
|
||||
uint32_t *guest_feat;
|
||||
uint32_t *host_feat;
|
||||
FeatureWord feat_word;
|
||||
} model_features_t;
|
||||
|
||||
/* KVM-specific features that are automatically added to all CPU models
|
||||
* when KVM is enabled.
|
||||
*/
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include "core-dc232b/core-isa.h"
|
||||
#include "overlay_tool.h"
|
||||
|
||||
static const XtensaConfig dc232b = {
|
||||
static const XtensaConfig dc232b __attribute__((unused)) = {
|
||||
.name = "dc232b",
|
||||
.gdb_regmap = {
|
||||
.num_regs = 120,
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include "core-dc233c/core-isa.h"
|
||||
#include "overlay_tool.h"
|
||||
|
||||
static const XtensaConfig dc233c = {
|
||||
static const XtensaConfig dc233c __attribute__((unused)) = {
|
||||
.name = "dc233c",
|
||||
.gdb_regmap = {
|
||||
.num_regs = 121,
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include "core-fsf/core-isa.h"
|
||||
#include "overlay_tool.h"
|
||||
|
||||
static const XtensaConfig fsf = {
|
||||
static const XtensaConfig fsf __attribute__((unused)) = {
|
||||
.name = "fsf",
|
||||
/* GDB for this core is not supported currently */
|
||||
.clock_freq_khz = 10000,
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include <glib.h>
|
||||
#include <stdint.h>
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/bitops.h"
|
||||
|
||||
typedef struct {
|
||||
|
@ -390,7 +390,8 @@ void os_mem_prealloc(int fd, char *area, size_t memory)
|
||||
pthread_sigmask(SIG_UNBLOCK, &set, &oldset);
|
||||
|
||||
if (sigsetjmp(sigjump, 1)) {
|
||||
fprintf(stderr, "os_mem_prealloc: failed to preallocate pages\n");
|
||||
fprintf(stderr, "os_mem_prealloc: Insufficient free host memory "
|
||||
"pages available to allocate guest RAM\n");
|
||||
exit(1);
|
||||
} else {
|
||||
int i;
|
||||
|
Loading…
Reference in New Issue
Block a user