mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rolf Eike Beer <eike-kernel@sf-tec.de>
To: linux-kernel@vger.kernel.org
Subject: [PATCH 2.4.23-pre3] do we want negative file descriptors?
Date: Mon, 8 Sep 2003 17:18:36 +0200	[thread overview]
Message-ID: <200309081718.36517@bilbo.math.uni-mannheim.de> (raw)

As far as I can see it does not make much sense to have negative fds
(which are in fact indexes for an array), so we can declare them unsigned.
Or not? (If yes, this one avoids some compiler warnings with gcc 3.3)

Eike

--- linux-2.4.23-pre3/include/linux/sched.h	2003-09-05 15:04:48.000000000 +0200
+++ linux-2.4.23-pre3-caliban/include/linux/sched.h	2003-09-07 11:04:34.000000000 +0200
@@ -172,9 +172,9 @@
 struct files_struct {
 	atomic_t count;
 	rwlock_t file_lock;	/* Protects all the below members.  Nests inside tsk->alloc_lock */
-	int max_fds;
-	int max_fdset;
-	int next_fd;
+	unsigned int max_fds;
+	unsigned int max_fdset;
+	unsigned int next_fd;
 	struct file ** fd;	/* current fd array */
 	fd_set *close_on_exec;
 	fd_set *open_fds;
--- linux-2.4.23-pre3/fs/file.c	2003-09-05 15:04:46.000000000 +0200
+++ linux-2.4.23-pre3-caliban/fs/file.c	2003-09-07 11:01:09.000000000 +0200
@@ -57,7 +57,8 @@
 int expand_fd_array(struct files_struct *files, int nr)
 {
 	struct file **new_fds;
-	int error, nfds;
+	int error;
+	unsigned int nfds;
 
 	
 	error = -EMFILE;
@@ -166,7 +167,8 @@
 int expand_fdset(struct files_struct *files, int nr)
 {
 	fd_set *new_openset = 0, *new_execset = 0;
-	int error, nfds = 0;
+	int error;
+	unsigned int nfds = 0;
 
 	error = -EMFILE;
 	if (files->max_fdset >= NR_OPEN || nr >= NR_OPEN)

                 reply	other threads:[~2003-09-08 15:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200309081718.36517@bilbo.math.uni-mannheim.de \
    --to=eike-kernel@sf-tec.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome