From: Davide Libenzi <davidel@xmailserver.org>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Andrew Morton <akpm@linux-foundation.org>,
Ulrich Drepper <drepper@redhat.com>, Ingo Molnar <mingo@elte.hu>,
Eric Dumazet <dada1@cosmosbay.com>
Subject: [patch 3/8] fdmap v2 - implement sys_nonseqfd
Date: Wed, 06 Jun 2007 15:30:31 -0700 [thread overview]
Message-ID: <send-serie.davidel@xmailserver.org.4625.1181169037.3> (raw)
This patch implement a new syscall sys_nonseqfd():
int nonseqfd(int fd, int flags);
The sys_nonseqfd() syscall can be used to map an existing file
descriptor inside the non-sequential fd area.
Signed-off-by: Davide Libenzi <davidel@xmailserver.org>
- Davide
Index: linux-2.6.mod/fs/fcntl.c
===================================================================
--- linux-2.6.mod.orig/fs/fcntl.c 2007-06-06 12:48:03.000000000 -0700
+++ linux-2.6.mod/fs/fcntl.c 2007-06-06 12:48:35.000000000 -0700
@@ -81,6 +81,25 @@
return fd;
}
+asmlinkage long sys_nonseqfd(unsigned int fd, unsigned int flags)
+{
+ struct files_struct *files = current->files;
+ int nfd = -EBADF;
+ struct file *file;
+
+ spin_lock(&files->file_lock);
+ if (!(file = fcheck(fd)))
+ goto out_unlock;
+ nfd = __alloc_nonseq_fd(files, flags);
+ if (likely(nfd >= 0))
+ get_file(file);
+out_unlock:
+ spin_unlock(&files->file_lock);
+ if (likely(nfd >= 0))
+ fd_install(nfd, file);
+ return nfd;
+}
+
static int dupfd(struct file *file, unsigned int start)
{
struct files_struct *files = current->files;
Index: linux-2.6.mod/include/linux/syscalls.h
===================================================================
--- linux-2.6.mod.orig/include/linux/syscalls.h 2007-06-06 12:38:27.000000000 -0700
+++ linux-2.6.mod/include/linux/syscalls.h 2007-06-06 12:48:35.000000000 -0700
@@ -302,6 +302,7 @@
asmlinkage long sys_fcntl64(unsigned int fd,
unsigned int cmd, unsigned long arg);
#endif
+asmlinkage long sys_nonseqfd(unsigned int fd, unsigned int flags);
asmlinkage long sys_dup(unsigned int fildes);
asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd);
asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int on);
reply other threads:[~2007-06-06 22:31 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=send-serie.davidel@xmailserver.org.4625.1181169037.3 \
--to=davidel@xmailserver.org \
--cc=akpm@linux-foundation.org \
--cc=dada1@cosmosbay.com \
--cc=drepper@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=torvalds@linux-foundation.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
all inboxes | Powered by JetHome®