#include "local.h"
/* Flush a single file, or (if fp is NULL) all files. */
-int ust_safe_fflush(LFILE *fp)
+int ust_safe_fflush(LTTNG_UST_LFILE *fp)
{
if (fp == NULL)
}
int
-__sflush(LFILE *fp)
+__sflush(LTTNG_UST_LFILE *fp)
{
unsigned char *p;
int n, t;
/*
* file extension
*/
-struct __sfileext {
- struct __sbuf _ub; /* ungetc buffer */
+struct __lttng_ust_sfileext {
+ struct __lttng_ust_sbuf _ub; /* ungetc buffer */
struct wchar_io_data _wcio; /* wide char io status */
};
-#define _EXT(fp) ((struct __sfileext *)((fp)->_ext._base))
+#define _EXT(fp) ((struct __lttng_ust_sfileext *)((fp)->_ext._base))
#define _UB(fp) _EXT(fp)->_ub
#define _FILEEXT_INIT(fp) \
* to the three different kinds of output buffering is handled here.
*/
int
-__sfvwrite(LFILE *fp, struct __suio *uio)
+__sfvwrite(LTTNG_UST_LFILE *fp, struct __lttng_ust_suio *uio)
{
size_t len;
char *p;
- struct __siov *iov;
+ struct __lttng_ust_siov *iov;
int w, s;
char *nl;
int nlknown, nldist;
/*
* I/O descriptors for __sfvwrite().
*/
-struct __siov {
+struct __lttng_ust_siov {
void *iov_base;
size_t iov_len;
};
-struct __suio {
- struct __siov *uio_iov;
+struct __lttng_ust_suio {
+ struct __lttng_ust_siov *uio_iov;
int uio_iovcnt;
int uio_resid;
};
-extern int __sfvwrite(LFILE *, struct __suio *);
+extern int __sfvwrite(LTTNG_UST_LFILE *, struct __lttng_ust_suio *);
#include "wcio.h"
#include "fileext.h"
-int __sflush(LFILE *);
-LFILE *__sfp(void);
-int __srefill(LFILE *);
+int __sflush(LTTNG_UST_LFILE *);
+LTTNG_UST_LFILE *__sfp(void);
+int __srefill(LTTNG_UST_LFILE *);
int __sread(void *, char *, int);
int __swrite(void *, const char *, int);
fpos_t __sseek(void *, fpos_t, int);
int __sclose(void *);
void __sinit(void);
void _cleanup(void);
-void __smakebuf(LFILE *);
-int __swhatbuf(LFILE *, size_t *, int *);
-int _fwalk(int (*)(LFILE *));
-int __swsetup(LFILE *);
+void __smakebuf(LTTNG_UST_LFILE *);
+int __swhatbuf(LTTNG_UST_LFILE *, size_t *, int *);
+int _fwalk(int (*)(LTTNG_UST_LFILE *));
+int __swsetup(LTTNG_UST_LFILE *);
int __sflags(const char *, int *);
-wint_t __fgetwc_unlock(LFILE *);
+wint_t __fgetwc_unlock(LTTNG_UST_LFILE *);
extern void __atexit_register_cleanup(void (*)(void));
extern int __sdidinit;
/*
- * Return true if the given LFILE cannot be written now.
+ * Return true if the given LTTNG_UST_LFILE cannot be written now.
*/
#define cantwrite(fp) \
((((fp)->_flags & __SWR) == 0 || (fp)->_bf._base == NULL) && \
{
int ret;
char dummy;
- LFILE f;
- struct __sfileext fext;
+ LTTNG_UST_LFILE f;
+ struct __lttng_ust_sfileext fext;
/* While snprintf(3) specifies size_t stdio uses an int internally */
if (n > INT_MAX)
#include <stdarg.h>
-struct __sbuf {
+struct __lttng_ust_sbuf {
unsigned char *_base;
int _size;
};
* _ub._base becomes non-nil (i.e., a stream has ungetc() data iff
* _ub._base!=NULL) and _up and _ur save the current values of _p and _r.
*/
-typedef struct __sFILE {
+typedef struct __lttng_ust_sFILE {
unsigned char *_p; /* current position in (some) buffer */
int _r; /* read space left for getc() */
int _w; /* write space left for putc() */
short _flags; /* flags, below; this FILE is free if 0 */
short _file; /* fileno, if Unix descriptor, else -1 */
- struct __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */
+ struct __lttng_ust_sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */
int _lbfsize; /* 0 or -_bf._size, for inline putc */
/* operations */
int (*_write)(void *, const char *, int);
/* extension data, to avoid further ABI breakage */
- struct __sbuf _ext;
+ struct __lttng_ust_sbuf _ext;
/* data for long sequences of ungetc() */
unsigned char *_up; /* saved _p when _p is doing ungetc data */
int _ur; /* saved _r when _r is counting ungetc data */
unsigned char _nbuf[1]; /* guarantee a getc() buffer */
/* separate buffer for fgetln() when line crosses buffer boundary */
- struct __sbuf _lb; /* buffer for fgetln() */
+ struct __lttng_ust_sbuf _lb; /* buffer for fgetln() */
/* Unix stdio files get aligned to block boundaries on fseek() */
int _blksize; /* stat.st_blksize (may be != _bf._size) */
fpos_t _offset; /* current lseek offset */
-} LFILE;
+} LTTNG_UST_LFILE;
#define __SLBF 0x0001 /* line buffered */
#define __SNBF 0x0002 /* unbuffered */
#define __sferror(p) (((p)->_flags & __SERR) != 0)
-extern int ust_safe_fflush(LFILE *fp);
-extern int ust_safe_vfprintf(LFILE *fp, const char *fmt0, va_list ap);
+extern int ust_safe_fflush(LTTNG_UST_LFILE *fp);
+extern int ust_safe_vfprintf(LTTNG_UST_LFILE *fp, const char *fmt0, va_list ap);
extern size_t ust_safe_mbrtowc(wchar_t *pwc, const char *s, size_t n, mbstate_t *ps);
* then reset it so that it can be reused.
*/
static int
-__sprint(LFILE *fp, struct __suio *uio)
+__sprint(LTTNG_UST_LFILE *fp, struct __lttng_ust_suio *uio)
{
int err;
* worries about ungetc buffers and so forth.
*/
//static int
-//__sbprintf(LFILE *fp, const char *fmt, va_list ap)
+//__sbprintf(LTTNG_UST_LFILE *fp, const char *fmt, va_list ap)
//{
// int ret;
-// LFILE fake;
+// LTTNG_UST_LFILE fake;
// struct __sfileext fakeext;
// unsigned char buf[BUFSIZ];
//
#define CHARINT 0x0800 /* 8 bit integer */
#define MAXINT 0x1000 /* largest integer size (intmax_t) */
-int ust_safe_vfprintf(LFILE *fp, const char *fmt0, va_list ap)
+int ust_safe_vfprintf(LTTNG_UST_LFILE *fp, const char *fmt0, va_list ap)
{
char *fmt; /* format string */
int ch; /* character from fmt */
int n, n2; /* handy integers (short term usage) */
char *cp; /* handy char pointer (short term usage) */
- struct __siov *iovp; /* for PRINT macro */
+ struct __lttng_ust_siov *iovp; /* for PRINT macro */
int flags; /* flags as above */
int ret; /* return value accumulator */
int width; /* width from format (%8d), or 0 */
int size; /* size of converted field or string */
const char *xdigs = NULL; /* digits for %[xX] conversion */
#define NIOV 8
- struct __suio uio; /* output information: summary */
- struct __siov iov[NIOV];/* ... and individual io vectors */
+ struct __lttng_ust_suio uio; /* output information: summary */
+ struct __lttng_ust_siov iov[NIOV];/* ... and individual io vectors */
char buf[BUF]; /* buffer with space for digits of uintmax_t */
char ox[2]; /* space for 0x; ox[1] is either x, X, or \0 */
union arg *argtable; /* args, built due to positional arg */
* _wsetup returns 0 if OK to write, nonzero otherwise.
*/
int
-__swsetup(LFILE *fp)
+__swsetup(LTTNG_UST_LFILE *fp)
{
/* make sure stdio is set up */
// if (!__sdidinit)