summaryrefslogtreecommitdiff
path: root/usr/src/lib/libc/inc/file64.h
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2020-03-27 11:29:00 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2020-03-27 11:29:00 +0000
commit6dcfbbc68f881fbf5c20d25817a0221dfb135170 (patch)
tree40307666f6d7711499061d8c4be75029a6d851e9 /usr/src/lib/libc/inc/file64.h
parentb0624b90ec9a0c04cca626925beee3ae403457ce (diff)
parentcd62a92d4a964bfe61d35ba2301b69e65e22a509 (diff)
downloadillumos-joyent-6dcfbbc68f881fbf5c20d25817a0221dfb135170.tar.gz
[illumos-gate merge]
commit cd62a92d4a964bfe61d35ba2301b69e65e22a509 7092 Want support for stdio memory streams 12360 fwrite can loop forever on zero byte write 12392 ftello64 doesn't handle ungetc() correctly when unbuffered commit 1470234269f4edea4cbf270cb2475e4988b788d5 12359 Want a means to set the umem mtbf at runtine commit 0ac311bae7f6f50d9ba506b52bd8860f2d68d4ce 12358 Need mbrtowc variant that indicates consumed zero bytes commit d726994754c938f91b6fd7e96b5cab3829615c58 12357 getc/putc_unlocked need to set orientation
Diffstat (limited to 'usr/src/lib/libc/inc/file64.h')
-rw-r--r--usr/src/lib/libc/inc/file64.h27
1 files changed, 24 insertions, 3 deletions
diff --git a/usr/src/lib/libc/inc/file64.h b/usr/src/lib/libc/inc/file64.h
index 40504d35ec..1bbc98e2bc 100644
--- a/usr/src/lib/libc/inc/file64.h
+++ b/usr/src/lib/libc/inc/file64.h
@@ -25,6 +25,10 @@
*/
/*
+ * Copyright 2020 Robert Mustacchi
+ */
+
+/*
* This is the header where the internal to libc definition of the FILE
* structure is defined. The exrernal defintion defines the FILE structure
* as an array of longs. This prevents customers from writing code that
@@ -41,8 +45,6 @@
#ifndef _FILE64_H
#define _FILE64_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <synch.h>
#include <stdio_tag.h>
#include <wchar_impl.h>
@@ -58,8 +60,25 @@ typedef __mbstate_t mbstate_t;
#define rmutex_t mutex_t
+typedef ssize_t (*fread_t)(__FILE *, char *, size_t);
+typedef ssize_t (*fwrite_t)(__FILE *, const char *, size_t);
+typedef off_t (*fseek_t)(__FILE *, off_t, int);
+typedef int (*fclose_t)(__FILE *);
+
+typedef struct {
+ fread_t std_read;
+ fwrite_t std_write;
+ fseek_t std_seek;
+ fclose_t std_close;
+ void *std_data;
+} stdio_ops_t;
+
#ifdef _LP64
+/*
+ * This structure cannot grow beyond its current size of 128 bytes. See the file
+ * lib/libc/port/stdio/README.design for more information.
+ */
struct __FILE_TAG {
unsigned char *_ptr; /* next character from/to here in buffer */
unsigned char *_base; /* the buffer */
@@ -69,7 +88,8 @@ struct __FILE_TAG {
unsigned int _flag; /* the state of the stream */
rmutex_t _lock; /* lock for this structure */
mbstate_t _state; /* mbstate_t */
- char __fill[32]; /* filler to bring size to 128 bytes */
+ stdio_ops_t *_ops; /* Alternate impl ops */
+ char __fill[24]; /* filler to bring size to 128 bytes */
};
#else
@@ -83,6 +103,7 @@ struct xFILEdata {
rmutex_t _lock; /* lock for this structure */
mbstate_t _state; /* mbstate_t */
int _altfd; /* alternate fd if > 255 */
+ stdio_ops_t *_ops; /* Alternate impl ops */
};
#define XFILEINITIALIZER { 0, NULL, RECURSIVEMUTEX, DEFAULTMBSTATE }