From ffb49b72f132d954a3d9fa11e45803c36a62fd25 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Mon, 26 Nov 2018 20:06:36 +0100 Subject: core: Add a limited version of gpgrt_ftruncate. * src/gpg-error.h.in (gpgrt_ftruncate, es_ftruncate): New. * src/gpg-error.def.in, src/gpg-error.vers: Add gpgrt_ftruncate. * src/visibility.c (gpgrt_ftruncate): new. * src/gpgrt-int.h (COOKIE_IOCTL_TRUNCATE): New. * src/estream.c (func_mem_ioctl): Support new internal IOCTL. (_gpgrt_ftruncate): New. -- Right now the ftruncate works only on memory streams. Can easily be added to other stream times. Signed-off-by: Werner Koch --- src/gpgrt-int.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/gpgrt-int.h') diff --git a/src/gpgrt-int.h b/src/gpgrt-int.h index b5a4dd1..09aad11 100644 --- a/src/gpgrt-int.h +++ b/src/gpgrt-int.h @@ -208,12 +208,12 @@ void _gpgrt_internal_trace_end (void); /* * A private cookie function to implement an internal IOCTL service. - * and ist IOCTL numbers. */ typedef int (*cookie_ioctl_function_t) (void *cookie, int cmd, void *ptr, size_t *len); #define COOKIE_IOCTL_SNATCH_BUFFER 1 #define COOKIE_IOCTL_NONBLOCK 2 +#define COOKIE_IOCTL_TRUNCATE 3 /* An internal variant of gpgrt_cookie_close_function_t with a slot * for the ioctl function. */ @@ -366,6 +366,7 @@ int _gpgrt_fseeko (gpgrt_stream_t stream, gpgrt_off_t offset, int whence); long int _gpgrt_ftell (gpgrt_stream_t stream); gpgrt_off_t _gpgrt_ftello (gpgrt_stream_t stream); void _gpgrt_rewind (gpgrt_stream_t stream); +int _gpgrt_ftruncate (estream_t stream, gpgrt_off_t length); int _gpgrt_fgetc (gpgrt_stream_t stream); int _gpgrt_fputc (int c, gpgrt_stream_t stream); -- cgit v1.2.3