search for: mkostemp

Displaying 20 results from an estimated 149 matches for "mkostemp".

2019 Jul 31
13
[nbdkit PATCH 0/8] fd leak safety
...e-requisite bugs to fix first before getting to my real goal...) Eric Blake (8): rate: Pass through delay failures server: Don't leave uninit variable on failure server: Add test for nbdkit_read_password Revert "RHEL 5: Define O_CLOEXEC and SOCK_CLOEXEC." cow, cache: Better mkostemp fallback server: Atomically set CLOEXEC on all fds filters: Set CLOEXEC on files opened during .config rate: Atomically set CLOEXEC on fds server/internal.h | 8 ---- filters/cache/blk.c | 19 ++++++++- filters/cow/blk.c | 19 ++++++++- filters/log/log.c...
2020 Mar 17
0
Re: [PATCH nbdkit v2] New tmpdisk plugin.
...(&disk, "%s/tmpdiskXXXXXX", tmpdir) == -1) { [2]...here, a user-supplied TMPDIR may require shell-quoting at the points above. > + nbdkit_error ("asprintf: %m"); > + goto error; > + } > + > + h->fd = mkstemp (disk); [3]...ouch - we are not using mkostemp() to atomically set FD_CLOEXEC, nor even mkstemp/fcntl() to set it after the fact due to Haiku still lacking mkostemp(). Note that in filters/cow/cow.c, we don't worry about a mutex when falling back due to missing mkostemp(), but that was done in .load, not .open. Here, Haiku would defin...
2018 Nov 09
0
Re: Further nbdkit patches for Haiku
...pushed: > > https://github.com/libguestfs/nbdkit/commit/e26fb6cea3fdba13b5472daf6767e76abacd8d03 > build: add missing #include "byte-swapping.h" > > https://github.com/libguestfs/nbdkit/commit/b962272a561bfed087316d24b7d510e4ab29a985 > build: more fallbacks for mkostemp > > The iconv patch makes iconv a requirement. I don't know how many > systems actually lack iconv -- probably not very many -- but even so I > don't want nbdkit to require a library just to compile a single > plugin, as a feature of nbdkit is that the minimal set of > r...
2020 Apr 07
2
[PATCH nbdkit v2] tmpdisk: Generalize the tmpdisk plugin
An evolution of v1 here: https://www.redhat.com/archives/libguestfs/2020-April/msg00035.html I want to generalize the tmpdisk plugin, particularly so you can use commands like ‘qemu-img create’ or even ‘virt-builder’. (Actually virt-builder really works - I tested it - but of course it causes a 30+ second delay when connecting to the server.) You can now use commands such as: nbdkit tmpdisk
2019 Aug 02
1
[nbdkit PATCH] server: Restrict thread model when no atomic CLOEXEC
...connection handle. =back diff --git a/configure.ac b/configure.ac index cabec5c8..054ad64a 100644 --- a/configure.ac +++ b/configure.ac @@ -193,6 +193,7 @@ AC_CHECK_HEADERS([\ dnl Check for functions in libc, all optional. AC_CHECK_FUNCS([\ + accept4 \ fdatasync \ get_current_dir_name \ mkostemp \ diff --git a/common/utils/utils.c b/common/utils/utils.c index 9ac3443b..029b6685 100644 --- a/common/utils/utils.c +++ b/common/utils/utils.c @@ -140,13 +140,15 @@ exit_status_to_nbd_error (int status, const char *cmd) */ int set_cloexec (int fd) { -#if defined SOCK_CLOEXEC && define...
2019 Aug 02
0
[nbdkit PATCH v2 04/17] Revert "RHEL 5: Define O_CLOEXEC and SOCK_CLOEXEC."
...he server to a child process. POSIX has required O_CLOEXEC since 2008, and that is long enough that we should start blindly relying on it. Meanwhile, POSIX doesn't yet specify full atomic interfaces everywhere (SOCK_CLOEXEC and accept4 when dealing with sockets, pipe2 when dealing with pipes, mkostemp and fopen("re") when dealing with stdio, etc.), but there has been an open bug since 2014 [2] recommending the full set of interfaces that will be mandatory in the next revision of POSIX. Most modern OS have caught up to that (RHEL 6 and FreeBSD 10 support SOCK_CLOEXEC, for example), and...
2019 Aug 02
23
[nbdkit PATCH v2 00/17] fd leak safety
...nt: Rename server/utils.c to server/public.c plugins: Expose more thread_model details in --dump-plugin server: Add utility functions for setting CLOEXEC and NONBLOCK Revert "RHEL 5: Define O_CLOEXEC and SOCK_CLOEXEC." build: Audit existing use of SOCK_CLOEXEC cow, cache: Better mkostemp fallback build: Audit for use of pipe2 rate: Atomically set CLOEXEC on fds server: Use atomic CLOEXEC for nbdkit_read_password plugins: Add .fork_safe field server: Atomically set CLOEXEC on accept fds filters: Set CLOEXEC on files opened during .config python: Use CLOEXEC on script...
2018 Nov 06
5
Further nbdkit patches for Haiku
...tches so far. This morning I pushed: https://github.com/libguestfs/nbdkit/commit/e26fb6cea3fdba13b5472daf6767e76abacd8d03 build: add missing #include "byte-swapping.h" https://github.com/libguestfs/nbdkit/commit/b962272a561bfed087316d24b7d510e4ab29a985 build: more fallbacks for mkostemp The iconv patch makes iconv a requirement. I don't know how many systems actually lack iconv -- probably not very many -- but even so I don't want nbdkit to require a library just to compile a single plugin, as a feature of nbdkit is that the minimal set of requirements. So I have modifi...
2020 Mar 17
2
[PATCH nbdkit v3] New tmpdisk plugin.
...ect mkfs output to /dev/null. Instead use exec </dev/null >/dev/null before the shell fragment. We may want to do this in other places where we run external shell scripts, or more generally for all plugins, but this commit does not fix this. - Improve can_multi_conn comment. - Use mkostemp if available. If not we have to use a racy mkstemp + set_cloexec instead. - I still didn't implement .zero, because the implementation (see plugins/file/file.c) is really complicated even if you remove the block device code. I guess it would be nice to isolate all this complexity int...
2018 Jan 20
4
[PATCH nbdkit] filters: Add copy-on-write filter.
Eric, you'll probably find the design "interesting" ... It does work, for me at least. Rich.
2019 Aug 02
0
[nbdkit PATCH v2 07/17] build: Audit for use of pipe2
...-layers.c | 4 +++- tests/test-streaming.c | 5 +++-- 6 files changed, 58 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index c6bb1b10..cabec5c8 100644 --- a/configure.ac +++ b/configure.ac @@ -196,6 +196,7 @@ AC_CHECK_FUNCS([\ fdatasync \ get_current_dir_name \ mkostemp \ + pipe2 \ posix_fadvise]) dnl Check whether printf("%m") works diff --git a/common/utils/utils.c b/common/utils/utils.c index 7b63b4d4..9ac3443b 100644 --- a/common/utils/utils.c +++ b/common/utils/utils.c @@ -140,13 +140,13 @@ exit_status_to_nbd_error (int status, const char *cmd)...
2020 Aug 18
0
[PATCH nbdkit 6/9] lib: Use replacement strategy for get_current_dir_name.
...| 2 +- 10 files changed, 69 insertions(+), 17 deletions(-) diff --git a/configure.ac b/configure.ac index aa586997..8c0398fe 100644 --- a/configure.ac +++ b/configure.ac @@ -327,7 +327,6 @@ AC_CHECK_FUNCS([\ fdatasync \ flockfile \ funlockfile \ - get_current_dir_name \ mkostemp \ mlock \ mlockall \ @@ -340,6 +339,7 @@ AC_CHECK_FUNCS([\ dnl Replacement functions that we provide for some platforms. AC_CONFIG_LIBOBJ_DIR([common/replacements]) AC_REPLACE_FUNCS([\ + get_current_dir_name \ getdelim \ getline \ openlog \ diff --git a/common/include/Makefile.am b/com...
2020 Mar 17
2
[PATCH nbdkit v2] New tmpdisk plugin.
This can be used for creating temporary disks to thin clients, as a kind of "remote tmpfs". See also: https://www.redhat.com/archives/libguestfs/2020-March/msg00134.html --- plugins/data/nbdkit-data-plugin.pod | 1 + plugins/file/nbdkit-file-plugin.pod | 1 + plugins/linuxdisk/nbdkit-linuxdisk-plugin.pod | 7 +- plugins/memory/nbdkit-memory-plugin.pod |
2018 Jan 20
0
[PATCH nbdkit] filters: Add copy-on-write filter.
...pdir = getenv ("TMPDIR"); + if (!tmpdir) + tmpdir = "/var/tmp"; + + nbdkit_debug ("cow: temporary directory for overlay: %s", tmpdir); + + len = strlen (tmpdir) + 8; + template = alloca (len); + snprintf (template, len, "%s/XXXXXX", tmpdir); + + fd = mkostemp (template, O_CLOEXEC); + if (fd == -1) { + nbdkit_error ("mkostemp: %s: %m", tmpdir); + exit (EXIT_FAILURE); + } + + unlink (template); + + if (ioctl (fd, FIGETBSZ, &blksize) == -1) { + nbdkit_error ("ioctl: FIGETBSZ: %m"); + exit (EXIT_FAILURE); + } + if (...
2018 Jan 22
1
[PATCH nbdkit] filters: Add caching filter.
This adds a cache filter, which works like the COW filter in reverse. For realistic use it needs a bit more work, especially to add limits on the size of the cache, a more sensible cache replacement policy, and perhaps some kind of background worker to write dirty blocks out. Rich.
2018 Feb 06
0
[PATCH v3 1/2] drm/virtio: Add window server support
...------------------------ 1. Client requests virtio driver to create a buffer suitable for sharing with host (DRM_VIRTGPU_RESOURCE_CREATE) 2. Virtio driver creates a new resource ID and passes the request to QEMU (VIRTIO_GPU_CMD_RESOURCE_CREATE_2D) 3. QEMU creates a shmem file (for example with mkostemp), associates that FD with the ID of this resource 4. QEMU maps that buffer to the guest's address space (KVM_SET_USER_MEMORY_REGION), passes the guest PFN to the virtio driver 5. DRM_VIRTGPU_RESOURCE_CREATE returns the resource id just created 6. Client mmaps it with DRM_IOCTL_VIRTGPU_MAP+...
2019 Aug 03
0
[nbdkit PATCH 3/3] server: Add and use nbdkit_nanosleep
...function exists to do the work on your behalf. + =head2 umask All plugins will see a L<umask(2)> of C<0022>. diff --git a/configure.ac b/configure.ac index 054ad64a..2a34bf8a 100644 --- a/configure.ac +++ b/configure.ac @@ -198,6 +198,7 @@ AC_CHECK_FUNCS([\ get_current_dir_name \ mkostemp \ pipe2 \ + ppoll \ posix_fadvise]) dnl Check whether printf("%m") works diff --git a/include/nbdkit-common.h b/include/nbdkit-common.h index 5257d992..e004aa18 100644 --- a/include/nbdkit-common.h +++ b/include/nbdkit-common.h @@ -82,6 +82,7 @@ extern int64_t nbdkit_parse_size (con...
2020 Jul 10
2
[PATCH nbdkit] New filter: gzip
...f (compressed_size == -1) + return -1; + + /* Create the temporary file. */ + tmpdir = getenv ("TMPDIR"); + if (!tmpdir) + tmpdir = LARGE_TMPDIR; + + len = strlen (tmpdir) + 8; + template = alloca (len); + snprintf (template, len, "%s/XXXXXX", tmpdir); + +#ifdef HAVE_MKOSTEMP + fd = mkostemp (template, O_CLOEXEC); +#else + /* This is only invoked serially with the lock held, so this is safe. */ + fd = mkstemp (template); + if (fd >= 0) { + fd = set_cloexec (fd); + if (fd < 0) { + int e = errno; + unlink (template); + errno = e; + } + }...
2010 Dec 14
8
builder-ubuntu febootstrap success 85db2a664c820e01a02ddc3b33b3da26fe05dc5b
...me is declared without a macro... yes checking whether getloadavg is declared without a macro... yes checking whether getsubopt is declared without a macro... yes checking whether grantpt is declared without a macro... yes checking whether mkdtemp is declared without a macro... yes checking whether mkostemp is declared without a macro... yes checking whether mkostemps is declared without a macro... yes checking whether mkstemp is declared without a macro... yes checking whether mkstemps is declared without a macro... yes checking whether ptsname is declared without a macro... yes checking whether rand...
2011 Jan 14
7
builder-ubuntu febootstrap success 85db2a664c820e01a02ddc3b33b3da26fe05dc5b
...me is declared without a macro... yes checking whether getloadavg is declared without a macro... yes checking whether getsubopt is declared without a macro... yes checking whether grantpt is declared without a macro... yes checking whether mkdtemp is declared without a macro... yes checking whether mkostemp is declared without a macro... yes checking whether mkostemps is declared without a macro... yes checking whether mkstemp is declared without a macro... yes checking whether mkstemps is declared without a macro... yes checking whether ptsname is declared without a macro... yes checking whether rand...