Displaying 20 results from an estimated 33 matches for "file_close".
Did you mean:
file_clock
2017 Jul 07
2
[New Patch] Fix disk corruption when writing
...e plausible.
>
> I think a better approach is to catch the error in the Rconn_printf
> calls (as R-devel currently does), and also catch errors on
> con->close(con). This one requires more changes to the source, so it
> may be a day or two before I commit.
I have testes it on file_close() and it works (cf. attached patch):
> fc=file("/dev/full", "w")
> write.csv("a", file=fc)
> close(fc)
Error in close.connection(fc) : closing file failed
>
> One thing I have to look into: is anyone making use of the fact that
> the R-level clo...
2016 Nov 13
1
Memory leak with tons of closed connections
...refer to the file and not the console */
#ifdef HAVE_FDOPEN
- fp = fdopen(0, con->mode);
+ fp = fdopen(dup(0), con->mode);
#else
warning(_("cannot open file '%s': %s"), name,
"fdopen is not supported on this platform");
@@ -633,8 +633,7 @@
static void file_close(Rconnection con)
{
Rfileconn this = con->private;
- if(con->isopen && strcmp(con->description, "stdin"))
- con->status = fclose(this->fp);
+ con->status = fclose(this->fp);
con->isopen = FALSE;
#ifdef Win32
if(this->anon_file) unli...
2018 Jan 31
1
[nbdkit PATCH] file: Add trim support
...o = EOPNOTSUPP;
+#endif
+ return r;
+}
+
static struct nbdkit_plugin plugin = {
.name = "file",
.longname = "nbdkit file plugin",
@@ -279,10 +318,12 @@ static struct nbdkit_plugin plugin = {
.open = file_open,
.close = file_close,
.get_size = file_get_size,
+ .can_trim = file_can_trim,
.pread = file_pread,
.pwrite = file_pwrite,
- .zero = file_zero,
.flush = file_flush,
+ .trim = file_trim,
+ .zero = file_zero,
.er...
2019 Mar 23
1
Re: [PATCH nbdkit 8/8] file: Implement extents.
...le.zero=1 */
> +/* Any callbacks using lseek must be protected by this lock. */
> +static pthread_mutex_t lseek_lock = PTHREAD_MUTEX_INITIALIZER;
> +
> +/* to enable: -D file.zero=1 */
> +int file_debug_zero;
>
> static void
> file_unload (void)
> @@ -220,6 +227,21 @@ file_close (void *handle)
>
> #define THREAD_MODEL NBDKIT_THREAD_MODEL_PARALLEL
>
> +/* For block devices, stat->st_size is not the true size. */
> +static int64_t
> +block_device_size (int fd)
> +{
> + off_t size;
> +
> + size = lseek (fd, 0, SEEK_END);
Calling lseek...
2020 Aug 07
0
[nbdkit PATCH 2/4] file: Add .list_exports support
...#ifdef BLKSSZGET
if (h->is_block_device) {
if (ioctl (h->fd, BLKSSZGET, &h->sector_size))
- nbdkit_debug ("cannot get sector size: %s: %m", filename);
+ nbdkit_debug ("cannot get sector size: %s: %m", h->file);
}
#endif
@@ -232,6 +315,7 @@ file_close (void *handle)
{
struct handle *h = handle;
+ free (h->file);
close (h->fd);
free (h);
}
@@ -239,7 +323,7 @@ file_close (void *handle)
#define THREAD_MODEL NBDKIT_THREAD_MODEL_PARALLEL
/* For block devices, stat->st_size is not the true size. The caller
- * grabs the lseek...
2019 Jan 05
0
[PATCH nbdkit v2 08/11] file: Return NBD_FLAG_CAN_MULTI_CONN for the file plugin.
...+/* Allow multiple parallel connections from a single client. */
+static int
+file_can_multi_conn (void *handle)
+{
+ return 1;
+}
+
static int
file_can_trim (void *handle)
{
@@ -507,6 +514,7 @@ static struct nbdkit_plugin plugin = {
.open = file_open,
.close = file_close,
.get_size = file_get_size,
+ .can_multi_conn = file_can_multi_conn,
.can_trim = file_can_trim,
.can_fua = file_can_fua,
.pread = file_pread,
--
2.19.2
2017 Jul 07
2
[New Patch] Fix disk corruption when writing
...k a better approach is to catch the error in the Rconn_printf
>>> calls (as R-devel currently does), and also catch errors on
>>> con->close(con). This one requires more changes to the source, so it
>>> may be a day or two before I commit.
>> I have testes it on file_close() and it works (cf. attached patch):
>>> fc=file("/dev/full", "w")
>>> write.csv("a", file=fc)
>>> close(fc)
>> Error in close.connection(fc) : closing file failed
>>
>>>
>>> One thing I have to look into: is an...
2017 Jul 06
2
[New Patch] Fix disk corruption when writing
I propose the following patch against the current R-devel/src/main/connection.c (cf. attached file).
It gives (on my linux box):
> fc=file("/dev/full", "w")
> write.csv("a", file=fc)
Error in writeLines(paste(col.names, collapse = sep), file, sep = eol) :
system call failure on writing
> close(fc)
Serguei.
Le 05/07/2017 ? 15:33, Serguei Sokol a ?crit
2019 Jan 05
0
[PATCH nbdkit v2 07/11] file: Implement NBDKIT_API_VERSION 2.
...= handle;
@@ -470,6 +488,9 @@ file_trim (void *handle, uint32_t count, uint64_t offset)
}
#endif
+ if ((flags & NBDKIT_FLAG_FUA) && file_flush (handle, 0) == -1)
+ return -1;
+
return 0;
}
@@ -487,6 +508,7 @@ static struct nbdkit_plugin plugin = {
.close = file_close,
.get_size = file_get_size,
.can_trim = file_can_trim,
+ .can_fua = file_can_fua,
.pread = file_pread,
.pwrite = file_pwrite,
.flush = file_flush,
--
2.19.2
2019 Mar 20
0
[PATCH nbdkit 8/8] file: Implement extents.
...le_debug_zero; /* to enable: -D file.zero=1 */
+/* Any callbacks using lseek must be protected by this lock. */
+static pthread_mutex_t lseek_lock = PTHREAD_MUTEX_INITIALIZER;
+
+/* to enable: -D file.zero=1 */
+int file_debug_zero;
static void
file_unload (void)
@@ -220,6 +227,21 @@ file_close (void *handle)
#define THREAD_MODEL NBDKIT_THREAD_MODEL_PARALLEL
+/* For block devices, stat->st_size is not the true size. */
+static int64_t
+block_device_size (int fd)
+{
+ off_t size;
+
+ size = lseek (fd, 0, SEEK_END);
+ if (size == -1) {
+ nbdkit_error ("lseek (to find devi...
2017 Jul 07
1
[New Patch] Fix disk corruption when writing
...the error in the Rconn_printf
>>>>> calls (as R-devel currently does), and also catch errors on
>>>>> con->close(con). This one requires more changes to the source, so it
>>>>> may be a day or two before I commit.
>>>> I have testes it on file_close() and it works (cf. attached patch):
>>>>> fc=file("/dev/full", "w")
>>>>> write.csv("a", file=fc)
>>>>> close(fc)
>>>> Error in close.connection(fc) : closing file failed
>>>>
>>>>>
&g...
2017 Jul 06
0
[New Patch] Fix disk corruption when writing
...>> I think a better approach is to catch the error in the Rconn_printf
>> calls (as R-devel currently does), and also catch errors on
>> con->close(con). This one requires more changes to the source, so it
>> may be a day or two before I commit.
> I have testes it on file_close() and it works (cf. attached patch):
>> fc=file("/dev/full", "w")
>> write.csv("a", file=fc)
>> close(fc)
> Error in close.connection(fc) : closing file failed
>
>>
>> One thing I have to look into: is anyone making use of the fact...
2017 Jul 07
0
[New Patch] Fix disk corruption when writing
...ach is to catch the error in the Rconn_printf
>>>> calls (as R-devel currently does), and also catch errors on
>>>> con->close(con). This one requires more changes to the source, so it
>>>> may be a day or two before I commit.
>>> I have testes it on file_close() and it works (cf. attached patch):
>>>> fc=file("/dev/full", "w")
>>>> write.csv("a", file=fc)
>>>> close(fc)
>>> Error in close.connection(fc) : closing file failed
>>>
>>>>
>>>> One thing...
2019 Mar 28
0
[PATCH nbdkit v5 FINAL 15/19] file: Implement extents.
...le_debug_zero; /* to enable: -D file.zero=1 */
+/* Any callbacks using lseek must be protected by this lock. */
+static pthread_mutex_t lseek_lock = PTHREAD_MUTEX_INITIALIZER;
+
+/* to enable: -D file.zero=1 */
+int file_debug_zero;
static void
file_unload (void)
@@ -220,6 +227,23 @@ file_close (void *handle)
#define THREAD_MODEL NBDKIT_THREAD_MODEL_PARALLEL
+/* For block devices, stat->st_size is not the true size. The caller
+ * grabs the lseek_lock.
+ */
+static int64_t
+block_device_size (int fd)
+{
+ off_t size;
+
+ size = lseek (fd, 0, SEEK_END);
+ if (size == -1) {
+...
2017 Nov 17
0
[nbdkit PATCH 6/6] Add --threads option for supporting true parallel requests
...--tls-certificates | -U | --unix | -u | --user)
args[$i]="$1"
((++i))
args[$i]="$2"
diff --git a/plugins/file/file.c b/plugins/file/file.c
index a603be8..ef5da3d 100644
--- a/plugins/file/file.c
+++ b/plugins/file/file.c
@@ -200,7 +200,7 @@ file_close (void *handle)
free (h);
}
-#define THREAD_MODEL NBDKIT_THREAD_MODEL_SERIALIZE_REQUESTS
+#define THREAD_MODEL NBDKIT_THREAD_MODEL_PARALLEL
/* Get the file size. */
static int64_t
diff --git a/src/connections.c b/src/connections.c
index 5257032..2d184b0 100644
--- a/src/connections.c
+++ b/s...
2016 Nov 11
2
Memory leak with tons of closed connections
On Fri, Nov 11, 2016 at 12:08 PM, Martin Maechler
<maechler at stat.math.ethz.ch> wrote:
>>>>>> Gergely Dar?czi <daroczig at rapporter.net>
>>>>>> on Thu, 10 Nov 2016 16:48:12 +0100 writes:
>
> > Dear All,
> > I'm developing an R application running inside of a Java daemon on
> > multiple threads, and
2019 Jan 04
10
[PATCH nbdkit 0/7] server: Implement NBD_FLAG_CAN_MULTI_CONN.
First thing to say is that I need to do a *lot* more testing on this,
so this is just an early peek. In particular, although it passed
‘make check && make check-valgrind’ I have *not* tested it against a
multi-conn-aware client such as the Linux kernel >= 4.9.
This implements NBD_FLAG_CAN_MULTI_CONN, described in the protocol doc
as:
"NBD_FLAG_CAN_MULTI_CONN: Indicates that
2020 Apr 09
0
[PATCH nbdkit v2 1/3] file: Move file operators to a new common/fileops mini-library.
...= false;
-#endif
-
-#ifdef FALLOC_FL_ZERO_RANGE
- h->can_zero_range = true;
-#else
- h->can_zero_range = false;
-#endif
-
- h->can_fallocate = true;
- h->can_zeroout = h->is_block_device;
-
- return h;
+ return fops;
}
/* Free up the per-connection handle. */
static void
file_close (void *handle)
{
- struct handle *h = handle;
+ struct fileops *fops = handle;
- close (h->fd);
- free (h);
+ close_fileops (fops);
+ free (fops);
}
#define THREAD_MODEL NBDKIT_THREAD_MODEL_PARALLEL
-/* For block devices, stat->st_size is not the true size. The caller
- * grab...
2020 Apr 09
1
[PATCH nbdkit PRELIMINARY] file: Move file operators to a new fileops mini-library
There's a lot of code in nbdkit-file-plugin which it would be nice to
reuse elsewhere. One possible approach (as outlined here) is simply
to move the file callbacks (like file.pread, file.pwrite, file.zero
etc) to a new mini-library. They can then be consumed by other
plugins fairly easily by doing:
static void *
foo_open (int readonly)
{
struct fileops *fops;
int fd, flags;
/*
2019 Jan 05
15
[PATCH nbdkit v2 01/11] server: Implement NBD_FLAG_CAN_MULTI_CONN.
For existing commits, this is almost identical to v1, except that I
updated some commit messages and reordered the commits in a somewhat
more logical sequence.
The main changes are the extra commits:
[06/11] plugins: Return NBD_FLAG_CAN_MULTI_CONN from some readonly plugins.
- Readonly plugins that can set the flag unconditionally.
[09/11] partitioning: Return NBD_FLAG_CAN_MULTI_CONN.
[10/11]