Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F143149053
D54354.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
10 KB
Referenced Files
None
Subscribers
None
D54354.diff
View Options
diff --git a/include/stdio.h b/include/stdio.h
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -126,7 +126,7 @@
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 */
+ short _fileno; /* (*) fileno, if Unix descriptor, else -1 */
struct __sbuf _bf; /* (*) the buffer (at least 1 byte, if !NULL) */
int _lbfsize; /* (*) 0 or -_bf._size, for inline putc */
@@ -499,7 +499,7 @@
#define __sfeof(p) (((p)->_flags & __SEOF) != 0)
#define __sferror(p) (((p)->_flags & __SERR) != 0)
#define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF)))
-#define __sfileno(p) ((p)->_file)
+#define __sfileno(p) ((p)->_fileno)
#define feof(p) (!__isthreaded ? __sfeof(p) : (feof)(p))
diff --git a/lib/libc/stdio/fclose.c b/lib/libc/stdio/fclose.c
--- a/lib/libc/stdio/fclose.c
+++ b/lib/libc/stdio/fclose.c
@@ -60,7 +60,7 @@
FREEUB(fp);
if (HASLB(fp))
FREELB(fp);
- fp->_file = -1;
+ fp->_fileno = -1;
fp->_r = fp->_w = 0; /* Mess up if reaccessed. */
/*
@@ -98,7 +98,7 @@
if (fp->_close != __sclose) {
r = EOF;
errno = EOPNOTSUPP;
- } else if (fp->_file < 0) {
+ } else if (fp->_fileno < 0) {
r = EOF;
errno = EBADF;
}
@@ -108,7 +108,7 @@
errno = err;
} else {
if (fdp != NULL)
- *fdp = fp->_file;
+ *fdp = fp->_fileno;
r = cleanfile(fp, false);
}
FUNLOCKFILE_CANCELSAFE();
diff --git a/lib/libc/stdio/fdopen.c b/lib/libc/stdio/fdopen.c
--- a/lib/libc/stdio/fdopen.c
+++ b/lib/libc/stdio/fdopen.c
@@ -49,7 +49,7 @@
int flags, oflags, fdflags, rc, tmp;
/*
- * File descriptors are a full int, but _file is only a short.
+ * File descriptors are a full int, but _fileno is only a short.
* If we get a valid file descriptor that is greater than
* SHRT_MAX, then the fd will get sign-extended into an
* invalid file descriptor. Handle this case by failing the
@@ -101,7 +101,7 @@
fp->_flags2 |= __S2OAP;
else if (oflags & O_APPEND)
fp->_flags |= __SAPP;
- fp->_file = fd;
+ fp->_fileno = fd;
fp->_cookie = fp;
fp->_read = __sread;
fp->_write = __swrite;
diff --git a/lib/libc/stdio/fileno.c b/lib/libc/stdio/fileno.c
--- a/lib/libc/stdio/fileno.c
+++ b/lib/libc/stdio/fileno.c
@@ -46,7 +46,7 @@
{
int fd;
- fd = fp->_file;
+ fd = fp->_fileno;
if (fd == -1)
errno = EBADF;
return (fd);
diff --git a/lib/libc/stdio/findfp.c b/lib/libc/stdio/findfp.c
--- a/lib/libc/stdio/findfp.c
+++ b/lib/libc/stdio/findfp.c
@@ -52,7 +52,7 @@
#define std(flags, file) { \
._flags = (flags), \
- ._file = (file), \
+ ._fileno = (file), \
._cookie = __sF + (file), \
._close = __sclose, \
._read = __sread, \
@@ -145,7 +145,7 @@
fp->_bf._base = NULL; /* no buffer */
fp->_bf._size = 0;
fp->_lbfsize = 0; /* not line buffered */
- fp->_file = -1; /* no file */
+ fp->_fileno = -1; /* no file */
/* fp->_cookie = <any>; */ /* caller sets cookie, _read/_write etc */
fp->_ub._base = NULL; /* no ungetc buffer */
fp->_ub._size = 0;
diff --git a/lib/libc/stdio/fopen.c b/lib/libc/stdio/fopen.c
--- a/lib/libc/stdio/fopen.c
+++ b/lib/libc/stdio/fopen.c
@@ -60,7 +60,7 @@
return (NULL);
}
/*
- * File descriptors are a full int, but _file is only a short.
+ * File descriptors are a full int, but _fileno is only a short.
* If we get a valid file descriptor that is greater than
* SHRT_MAX, then the fd will get sign-extended into an
* invalid file descriptor. Handle this case by failing the
@@ -72,7 +72,7 @@
errno = EMFILE;
return (NULL);
}
- fp->_file = f;
+ fp->_fileno = f;
fp->_flags = flags;
fp->_cookie = fp;
fp->_read = __sread;
diff --git a/lib/libc/stdio/freopen.c b/lib/libc/stdio/freopen.c
--- a/lib/libc/stdio/freopen.c
+++ b/lib/libc/stdio/freopen.c
@@ -81,7 +81,7 @@
fp = NULL;
goto end;
}
- if ((dflags = _fcntl(fp->_file, F_GETFL)) < 0) {
+ if ((dflags = _fcntl(fp->_fileno, F_GETFL)) < 0) {
sverrno = errno;
fclose(fp);
errno = sverrno;
@@ -101,7 +101,7 @@
if ((oflags ^ dflags) & O_APPEND) {
dflags &= ~O_APPEND;
dflags |= oflags & O_APPEND;
- if (_fcntl(fp->_file, F_SETFL, dflags) < 0) {
+ if (_fcntl(fp->_fileno, F_SETFL, dflags) < 0) {
sverrno = errno;
fclose(fp);
errno = sverrno;
@@ -110,16 +110,16 @@
}
}
if (oflags & O_TRUNC)
- (void) ftruncate(fp->_file, (off_t)0);
+ (void) ftruncate(fp->_fileno, (off_t)0);
if (!(oflags & O_APPEND))
(void) _sseek(fp, (fpos_t)0, SEEK_SET);
if ((oflags & O_CLOEXEC) != 0) {
- fdflags = _fcntl(fp->_file, F_GETFD, 0);
+ fdflags = _fcntl(fp->_fileno, F_GETFD, 0);
if (fdflags != -1 && (fdflags & FD_CLOEXEC) == 0)
- (void) _fcntl(fp->_file, F_SETFD,
+ (void) _fcntl(fp->_fileno, F_SETFD,
fdflags | FD_CLOEXEC);
}
- f = fp->_file;
+ f = fp->_fileno;
isopen = 0;
wantfd = -1;
goto finish;
@@ -143,7 +143,7 @@
(void) __sflush(fp);
/* if close is NULL, closing is a no-op, hence pointless */
isopen = fp->_close != NULL;
- if ((wantfd = fp->_file) < 0 && isopen) {
+ if ((wantfd = fp->_fileno) < 0 && isopen) {
(void) (*fp->_close)(fp->_cookie);
isopen = 0;
}
@@ -209,11 +209,11 @@
(void)_close(f);
f = wantfd;
} else
- (void)_close(fp->_file);
+ (void)_close(fp->_fileno);
}
/*
- * File descriptors are a full int, but _file is only a short.
+ * File descriptors are a full int, but _fileno is only a short.
* If we get a valid file descriptor that is greater than
* SHRT_MAX, then the fd will get sign-extended into an
* invalid file descriptor. Handle this case by failing the
@@ -227,7 +227,7 @@
}
fp->_flags = flags;
- fp->_file = f;
+ fp->_fileno = f;
fp->_cookie = fp;
fp->_read = __sread;
fp->_write = __swrite;
diff --git a/lib/libc/stdio/fseek.c b/lib/libc/stdio/fseek.c
--- a/lib/libc/stdio/fseek.c
+++ b/lib/libc/stdio/fseek.c
@@ -168,7 +168,7 @@
goto dumb;
if ((fp->_flags & __SOPT) == 0) {
if (seekfn != __sseek ||
- fp->_file < 0 || _fstat(fp->_file, &st) ||
+ fp->_fileno < 0 || _fstat(fp->_fileno, &st) ||
(st.st_mode & S_IFMT) != S_IFREG) {
fp->_flags |= __SNPT;
goto dumb;
@@ -184,7 +184,7 @@
if (whence == SEEK_SET)
target = offset;
else {
- if (_fstat(fp->_file, &st))
+ if (_fstat(fp->_fileno, &st))
goto dumb;
if (offset > 0 && st.st_size > OFF_MAX - offset) {
errno = EOVERFLOW;
diff --git a/lib/libc/stdio/funopen.c b/lib/libc/stdio/funopen.c
--- a/lib/libc/stdio/funopen.c
+++ b/lib/libc/stdio/funopen.c
@@ -62,7 +62,7 @@
if ((fp = __sfp()) == NULL)
return (NULL);
fp->_flags = flags;
- fp->_file = -1;
+ fp->_fileno = -1;
fp->_cookie = (void *)cookie;
fp->_read = readfn;
fp->_write = writefn;
diff --git a/lib/libc/stdio/local.h b/lib/libc/stdio/local.h
--- a/lib/libc/stdio/local.h
+++ b/lib/libc/stdio/local.h
@@ -128,7 +128,7 @@
* Structure initializations for 'fake' FILE objects.
*/
#define FAKE_FILE { \
- ._file = -1, \
+ ._fileno = -1, \
._fl_mutex = PTHREAD_MUTEX_INITIALIZER, \
}
diff --git a/lib/libc/stdio/makebuf.c b/lib/libc/stdio/makebuf.c
--- a/lib/libc/stdio/makebuf.c
+++ b/lib/libc/stdio/makebuf.c
@@ -74,7 +74,7 @@
flags |= __SMBF;
fp->_bf._base = fp->_p = p;
fp->_bf._size = size;
- if (couldbetty && isatty(fp->_file))
+ if (couldbetty && isatty(fp->_fileno))
flags |= __SLBF;
fp->_flags |= flags;
}
@@ -87,7 +87,7 @@
{
struct stat st;
- if (fp->_file < 0 || _fstat(fp->_file, &st) < 0) {
+ if (fp->_fileno < 0 || _fstat(fp->_fileno, &st) < 0) {
*couldbetty = 0;
*bufsize = BUFSIZ;
return (__SNPT);
diff --git a/lib/libc/stdio/perror.c b/lib/libc/stdio/perror.c
--- a/lib/libc/stdio/perror.c
+++ b/lib/libc/stdio/perror.c
@@ -65,7 +65,7 @@
v->iov_len = 1;
FLOCKFILE_CANCELSAFE(stderr);
__sflush(stderr);
- (void)_writev(stderr->_file, iov, (v - iov) + 1);
+ (void)_writev(stderr->_fileno, iov, (v - iov) + 1);
stderr->_flags &= ~__SOFF;
FUNLOCKFILE_CANCELSAFE();
}
diff --git a/lib/libc/stdio/stdio.c b/lib/libc/stdio/stdio.c
--- a/lib/libc/stdio/stdio.c
+++ b/lib/libc/stdio/stdio.c
@@ -50,7 +50,7 @@
{
FILE *fp = cookie;
- return(_read(fp->_file, buf, (size_t)n));
+ return(_read(fp->_fileno, buf, (size_t)n));
}
int
@@ -58,7 +58,7 @@
{
FILE *fp = cookie;
- return (_write(fp->_file, buf, (size_t)n));
+ return (_write(fp->_fileno, buf, (size_t)n));
}
fpos_t
@@ -66,14 +66,14 @@
{
FILE *fp = cookie;
- return (lseek(fp->_file, (off_t)offset, whence));
+ return (lseek(fp->_fileno, (off_t)offset, whence));
}
int
__sclose(void *cookie)
{
- return (_close(((FILE *)cookie)->_file));
+ return (_close(((FILE *)cookie)->_fileno));
}
/*
diff --git a/lib/libc/stdio/vdprintf.c b/lib/libc/stdio/vdprintf.c
--- a/lib/libc/stdio/vdprintf.c
+++ b/lib/libc/stdio/vdprintf.c
@@ -57,7 +57,7 @@
f._p = buf;
f._w = sizeof(buf);
f._flags = __SWR;
- f._file = fd;
+ f._fileno = fd;
f._cookie = &f;
f._write = __swrite;
f._bf._base = buf;
diff --git a/lib/libc/stdio/vfprintf.c b/lib/libc/stdio/vfprintf.c
--- a/lib/libc/stdio/vfprintf.c
+++ b/lib/libc/stdio/vfprintf.c
@@ -182,7 +182,7 @@
/* copy the important variables */
fake._flags = fp->_flags & ~__SNBF;
- fake._file = fp->_file;
+ fake._fileno = fp->_fileno;
fake._cookie = fp->_cookie;
fake._write = fp->_write;
fake._orientation = fp->_orientation;
@@ -275,7 +275,7 @@
FLOCKFILE_CANCELSAFE(fp);
/* optimise fprintf(stderr) (and other unbuffered Unix files) */
if ((fp->_flags & (__SNBF|__SWR|__SRW)) == (__SNBF|__SWR) &&
- fp->_file >= 0)
+ fp->_fileno >= 0)
ret = __sbprintf(fp, locale, serrno, fmt0, ap);
else
ret = __vfprintf(fp, locale, serrno, fmt0, ap);
diff --git a/lib/libc/stdio/vfwprintf.c b/lib/libc/stdio/vfwprintf.c
--- a/lib/libc/stdio/vfwprintf.c
+++ b/lib/libc/stdio/vfwprintf.c
@@ -218,7 +218,7 @@
/* copy the important variables */
fake._flags = fp->_flags & ~__SNBF;
- fake._file = fp->_file;
+ fake._fileno = fp->_fileno;
fake._cookie = fp->_cookie;
fake._write = fp->_write;
fake._orientation = fp->_orientation;
@@ -353,7 +353,7 @@
FLOCKFILE_CANCELSAFE(fp);
/* optimise fprintf(stderr) (and other unbuffered Unix files) */
if ((fp->_flags & (__SNBF|__SWR|__SRW)) == (__SNBF|__SWR) &&
- fp->_file >= 0)
+ fp->_fileno >= 0)
ret = __sbprintf(fp, locale, fmt0, ap);
else
ret = __vfwprintf(fp, locale, fmt0, ap);
diff --git a/lib/libc/stdio/xprintf.c b/lib/libc/stdio/xprintf.c
--- a/lib/libc/stdio/xprintf.c
+++ b/lib/libc/stdio/xprintf.c
@@ -575,7 +575,7 @@
/* copy the important variables */
fake._flags = fp->_flags & ~__SNBF;
- fake._file = fp->_file;
+ fake._fileno = fp->_fileno;
fake._cookie = fp->_cookie;
fake._write = fp->_write;
fake._orientation = fp->_orientation;
@@ -612,7 +612,7 @@
/* optimise fprintf(stderr) (and other unbuffered Unix files) */
if ((fp->_flags & (__SNBF|__SWR|__SRW)) == (__SNBF|__SWR) &&
- fp->_file >= 0)
+ fp->_fileno >= 0)
return (__v3printf(fp, fmt0, u, ap));
else
return (__v2printf(fp, fmt0, u, ap));
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jan 27, 2:37 PM (14 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28057313
Default Alt Text
D54354.diff (10 KB)
Attached To
Mode
D54354: stdio: rename _file to _fileno in struct __sFILE
Attached
Detach File
Event Timeline
Log In to Comment