public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joel Eriksson <jen@ettnet.se>
To: linux-kernel@vger.kernel.org
Subject: Socket hack question.
Date: Thu, 19 Apr 2001 00:28:52 +0200	[thread overview]
Message-ID: <20010419002852.A24647@seth> (raw)

Hello,

I am a kernel hacking newbie and am struggling to understand the
networking subsystem. I would like to be able to add a systemcall,
preferably asynchronous, that connects a socket with a filedescriptor
(proxy(srcsd, dstfd)) so that everything received on srcsd is directly
written to dstfd. The proxy should close when srcsd is closed or when
a zero-size packet is sent (or something like that..).

I started digging in the source yesterday, and have read a little
in "The Linux Kernel" document and a few others, but can't say I
feel much wiser. :-) I was thinking about creating a custom "data_ready"
function that I set for the socket to be forwarded (in "struct sock"),
does this make sense? How would I go about to write the data to the
destination file/socket descriptor?

I am of course fully aware that it is not of public interest and
have certainly not intended to try getting it into the mainstream
kernel. :-) I'm just going to use it for a web server I am developing
that communicates with applications via sockets (UNIX domain for
local apps and TCP for remote), portability is not an issue in this
particular case. Another obvious use is for bouncers.

I would like to avoid the kernel -> userspace -> kernel copying
of data just to forward a packet.. The web server should be able
to scale up to a couple of thousands simultaneous connections
without significant performance penalty, so I plan to use multiple
processes or perhaps threads to avoid the bad scalability of
select()/poll().

When I (or if I :-) get more proficient in kernel hacking I will
perhaps try adding support for fully event-driven I/O handling.
Or are there perhaps any similar patches available from somewhere
already?

-- 
Joel Eriksson

             reply	other threads:[~2001-04-18 20:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-18 22:28 Joel Eriksson [this message]
2001-04-18 21:31 ` Socket hack question Andi Kleen
  -- strict thread matches above, loose matches on Subject: below --
2001-04-19  1:03 Joel Eriksson
     [not found] ` <Pine.LNX.4.10.10104181931310.14361-100000@coffee.psychology.mcmaster.ca>
2001-04-19  2:06   ` Joel Eriksson

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=20010419002852.A24647@seth \
    --to=jen@ettnet.se \
    --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