Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/sys struct file: bump f_count and f_msgcount to u_int, t...
details: https://anonhg.NetBSD.org/src/rev/3d3f7f6c374a
branches: trunk
changeset: 519499:3d3f7f6c374a
user: jdolecek <jdolecek%NetBSD.org@localhost>
date: Tue Dec 18 22:29:25 2001 +0000
description:
struct file: bump f_count and f_msgcount to u_int, to protect against
counter overflow. Fixes kern/5080 by David A. Holland.
Also move f_usecount & f_iflags to better place, and make f_type int.
Note: the maximum possible number of references to a struct file is
maxfiles + unp_rights == 2 * INT_MAX
diffstat:
sys/sys/file.h | 15 +++++++--------
1 files changed, 7 insertions(+), 8 deletions(-)
diffs (39 lines):
diff -r 97751c9a3d33 -r 3d3f7f6c374a sys/sys/file.h
--- a/sys/sys/file.h Tue Dec 18 19:43:24 2001 +0000
+++ b/sys/sys/file.h Tue Dec 18 22:29:25 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: file.h,v 1.30 2001/12/07 07:09:30 jdolecek Exp $ */
+/* $NetBSD: file.h,v 1.31 2001/12/18 22:29:25 jdolecek Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -56,13 +56,14 @@
struct file {
LIST_ENTRY(file) f_list; /* list of active files */
int f_flag; /* see fcntl.h */
+ int f_iflags; /* internal flags */
#define DTYPE_VNODE 1 /* file */
#define DTYPE_SOCKET 2 /* communications endpoint */
#define DTYPE_PIPE 3 /* pipe */
- short f_type; /* descriptor type */
- short f_count; /* reference count */
- short f_msgcount; /* references from message queue */
- short f_pad0; /* spare */
+ int f_type; /* descriptor type */
+ u_int f_count; /* reference count */
+ u_int f_msgcount; /* references from message queue */
+ int f_usecount; /* number active users */
struct ucred *f_cred; /* creds associated with descriptor */
struct fileops {
int (*fo_read) (struct file *fp, off_t *offset,
@@ -82,9 +83,7 @@
int (*fo_close) (struct file *fp, struct proc *p);
} *f_ops;
off_t f_offset;
- caddr_t f_data; /* vnode or socket */
- int f_iflags; /* internal flags */
- int f_usecount; /* number active users */
+ caddr_t f_data; /* descriptor data, e.g. vnode/socket */
};
#define FIF_WANTCLOSE 0x01 /* a close is waiting for usecount */
Home |
Main Index |
Thread Index |
Old Index