]> git.proxmox.com Git - qemu.git/blobdiff - osdep.c
update
[qemu.git] / osdep.c
diff --git a/osdep.c b/osdep.c
index aa061a90ad1d2ec78a06eb243a4c057875960782..087a5c2185a3dad5f255ec54d91fe762a8c825e8 100644 (file)
--- a/osdep.c
+++ b/osdep.c
@@ -143,6 +143,22 @@ void *shmat(int shmid, const void *shmaddr, int shmflg)
     return ptr;
 }
 
+/****************************************************************/
+/* sigaction bypassing the threads */
+
+static int kernel_sigaction(int signum, const struct qemu_sigaction *act, 
+                            struct qemu_sigaction *oldact, 
+                            int sigsetsize)
+{
+    QEMU_SYSCALL4(rt_sigaction, signum, act, oldact, sigsetsize);
+}
+
+int qemu_sigaction(int signum, const struct qemu_sigaction *act, 
+                   struct qemu_sigaction *oldact)
+{
+    return kernel_sigaction(signum, act, oldact, 8);
+}
+
 /****************************************************************/
 /* memory allocation */
 
@@ -235,6 +251,8 @@ void qemu_free(void *ptr)
 {
     MemoryBlock *mb;
 
+    if (!ptr)
+        return;
     mb = (MemoryBlock *)((uint8_t *)ptr - BLOCK_HEADER_SIZE);
     mb->next = first_free_block;
     first_free_block = mb;
@@ -292,6 +310,16 @@ void *qemu_mallocz(size_t size)
     return ptr;
 }
 
+char *qemu_strdup(const char *str)
+{
+    char *ptr;
+    ptr = qemu_malloc(strlen(str) + 1);
+    if (!ptr)
+        return NULL;
+    strcpy(ptr, str);
+    return ptr;
+}
+
 /****************************************************************/
 /* printf support */