summaryrefslogtreecommitdiffstats
path: root/include/qemu/osdep.h
Commit message (Collapse)AuthorAgeFilesLines
* memory: expose alignment used for allocating RAM as MemoryRegion APIIgor Mammedov2014-11-231-1/+2
| | | | | | | | | | introduce memory_region_get_alignment() that returns underlying memory block alignment or 0 if it's not relevant/implemented for backend. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* util: introduce MIN_NON_ZEROPeter Lieven2014-11-031-0/+6
| | | | | | | | | | | | at least in block layer we have the case of limits being defined for a BlockDriverState. However, in this context often zero (0) has the special meanining of undefined which means no limit. If two of those limits are combined and the minimum is needed the minimum function should only return zero if both parameters are zero. Signed-off-by: Peter Lieven <pl@kamp.de> Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* util: Move general qemu_getauxval to util/getauxval.cFam Zheng2014-09-091-4/+0
| | | | | | | | | So that we won't have an empty getauxval.o which is disliked by ranlib. Reported-by: Peter Maydell <peter.maydell@linaro.org> Tested-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* block: Introduce qemu_try_blockalign()Kevin Wolf2014-08-151-0/+1
| | | | | | | This function returns NULL instead of aborting when an allocation fails. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Benoit Canet <benoit@irqsave.net>
* qemu/osdep: Remove the need for qemu_init_auxvalRichard Henderson2014-06-231-12/+0
| | | | | | | | | Instead of getting backup auxv data from the env pointer given to main, read it from /proc/self/auxv. We can do this at any time, so we're not tied to any ordering wrt a call to qemu_init_auxval from main. Tested-by: Tom Musta <tommusta@gmail.com> Signed-off-by: Richard Henderson <rth@twiddle.net>
* hostmem: add merge and dump propertiesPaolo Bonzini2014-06-191-0/+10
| | | | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* osdep: add merge and dump flagsMichael S. Tsirkin2014-06-191-0/+4
| | | | | | will be used by follow up patch Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* memory: move preallocation code out of exec.cPaolo Bonzini2014-06-191-0/+2
| | | | | | | | | | | | So that backends can use it. Since we need the page size for efficiency, move code to compute it out of translate-all.c and into util/oslib-win32.c. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* util: Split out exec_dir from os_find_datadirFam Zheng2014-02-201-0/+9
| | | | | | | | | With this change, main() calls qemu_init_exec_dir and uses argv[0] to init exec_dir. The saved value can be retrieved with qemu_get_exec_dir later. It will be reused by module loading. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* osdep: add qemu_set_tty_echo()Stefan Hajnoczi2014-01-221-0/+2
| | | | | | | | | Using stdin with readline.c requires disabling echo and line buffering. Add a portable wrapper to set the terminal attributes under Linux and Windows. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* osdep: Create qemu_getauxval and qemu_init_auxvalRichard Henderson2013-11-301-0/+25
| | | | | | Abstract away dependence on a system implementation of getauxval. Signed-off-by: Richard Henderson <rth@twiddle.net>
* osdep: add qemu_get_local_state_pathname()Laszlo Ersek2013-05-301-0/+11
| | | | | | | | | | | | | | | This function returns ${prefix}/var/RELATIVE_PATHNAME on POSIX-y systems, and <CSIDL_COMMON_APPDATA>/RELATIVE_PATHNAME on Win32. http://msdn.microsoft.com/en-us/library/bb762494.aspx [...] This folder is used for application data that is not user specific. For example, an application can store a spell-check dictionary, a database of clip art, or a log file in the CSIDL_COMMON_APPDATA folder. [...] Signed-off-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
* osdep: introduce qemu_anon_ram_free to free qemu_anon_ram_alloc-ed memoryPaolo Bonzini2013-05-141-0/+1
| | | | | | | | | | | | | | | We switched from qemu_memalign to mmap() but then we don't modify qemu_vfree() to do a munmap() over free(). Which we cannot do because qemu_vfree() frees memory allocated by qemu_{mem,block}align. Introduce a new function that does the munmap(), luckily the size is available in the RAMBlock. Reported-by: Amos Kong <akong@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Amos Kong <akong@redhat.com> Message-id: 1368454796-14989-3-git-send-email-pbonzini@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* osdep, kvm: rename low-level RAM allocation functionsPaolo Bonzini2013-05-141-1/+1
| | | | | | | | | | This is preparatory to the introduction of a separate freeing API. Reported-by: Amos Kong <akong@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Amos Kong <akong@redhat.com> Message-id: 1368454796-14989-2-git-send-email-pbonzini@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* osdep.h: include sys/types.h for ssize_t definitionIgor Mitsyanko2013-05-121-1/+1
| | | | | | | | | | | sys/types.h is taken out from "ifdef __OpenBSD__" guard. It should be safe for other systems, according to following survey: http://hacks.owlfolio.org/header-survey/ This fixes build for CONFIG_IOVEC-less systems (mingw). Signed-off-by: Igor Mitsyanko <i.mitsyanko@gmail.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
* win32: add readv/writev emulationPaolo Bonzini2013-04-291-0/+17
| | | | | | | | | | | | | | | Commit e9d8fbf (qemu-file: do not use stdio for qemu_fdopen, 2013-03-27) introduced a usage of writev, which mingw32 does not have. Even though qemu_fdopen itself is not used on mingw32, the future-proof solution is to add an implementation of it. This is simple and similar to how we emulate sendmsg/recvmsg in util/iov.c. Some files include osdep.h without qemu-common.h, so move the definition of iovec to osdep.h too, and include osdep.h from qemu-common.h unconditionally (protection against including files when NEED_CPU_H is defined is not needed since the removal of AREG0). Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* virtio-scsi: create VirtIOSCSICommonPaolo Bonzini2013-04-191-0/+4
| | | | | | | | | | This patch refactors existing virtio-scsi code into VirtIOSCSICommon in order to allow virtio_scsi_init_common() to be used by both internal virtio_scsi_init() and external vhost-scsi-pci code. Cc: Michael S. Tsirkin <mst@redhat.com> Cc: Asias He <asias@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* qemu-file: check exit status when closing a pipe QEMUFilePaolo Bonzini2013-03-111-0/+7
| | | | | | | | | This is what exec_close does. Move this to the underlying QEMUFile. Reviewed-by: Orit Wasserman <owasserm@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* misc: move include files to include/qemu/Paolo Bonzini2012-12-191-0/+178
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
OpenPOWER on IntegriCloud