1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00
Commit Graph

21 Commits

Author SHA1 Message Date
Volker Lendecke
258ce91f31 lib: Move sys_rw* to lib/util
genrand.c will require it soon

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-13 01:23:07 +02:00
Volker Lendecke
97b2570a5e lib: Split out sys_[read|write] & friends
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-12-07 00:12:07 +01:00
Volker Lendecke
fb9067c789 Remove a few #ifdef EWOULDBLOCk
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-09-18 20:36:11 +02:00
Jeremy Allison
b8ae6f8f57 s3:smbd: let default_sys_recvfile() and sys_recvfile() cope with non-blocking sockets.
default_sys_recvfile() and splice() recvfile were not
written to cope with non-blocking sockets.

When either the socket read() or splice() return
-1 with errno EWOULDBLOCK or EAGAIN, if no bytes have been
processed yet, return -1 and let the caller set
blocking and retry. If bytes have been processed,
just return them as a short read and let the
caller retry with the remaining needed reads.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-05-24 13:48:14 +02:00
Stefan Metzmacher
f71780202a s3:lib: use stack buffers in drain_socket() and default_sys_recvfile()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-04-11 21:41:07 +02:00
Jeremy Allison
1b46db7b24 Ensure drain_socket() operates on a blocking socket.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan (metze) Metzmacher <metze@samba.org>
2013-04-19 14:11:23 -07:00
Andrew Bartlett
6aa12fcb30 build: Remove SMB_OFF_T, replace with off_t
Now that we always require a 64 bit off_t, we no longer need SMB_OFF_T.

Andrew Bartlett

Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Fri Apr  6 01:47:43 CEST 2012 on sn-devel-104
2012-04-06 01:47:43 +02:00
Andrew Bartlett
43e9be8894 build: Remove sys_lseek wrapper 2012-04-05 02:39:08 +02:00
Jeremy Allison
5e6263960a Third part of fix for bug #8679 - recvfile code path using splice() on Linux leaves data in the pipe on short write.
Fix default_sys_recvfile() to correctly cope with
short writes. Return the amount written. Return
-1 and set errno if no data could be written.
2011-12-30 20:45:10 -08:00
Jeremy Allison
a5715420e3 Second part of fix for bug #8679 - recvfile code path using splice() on Linux leaves data in the pipe on short write.
Split out the functionality of drain_socket() into a separate
function from default_sys_recvfile().
2011-12-30 20:23:00 -08:00
Jeremy Allison
eb617374a6 Fix bug #8679 - recvfile code path using splice() on Linux leaves data in the pipe on short write
Bug found and fix suggested by Andrew Bartlett.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Sun Dec 25 07:46:38 CET 2011 on sn-devel-104
2011-12-25 07:46:38 +01:00
Günther Deschner
0e771263ee s3-includes: only include system/filesys.h when needed.
Guenther
2011-03-30 01:13:07 +02:00
Volker Lendecke
e1459a2379 Several fixes to our use of splice
The splice manpage explicitly requires loff_t as offset. Copy "offset" there.
Probably not required, but I wanted to make sure it's as required.

Splice blocks with large buffers. For me it worked with 16k and blocked with
32k and beyond. It would be nice to see a clarification in the manpage of
splice for this behaviour.

Splice if used with an offset increments the offset. From the manpage this was
at least not entirely obvious :-)

I haven't yet activated this (try_splice_call ist still false by default), it
needs more testing.

Volker
2009-01-07 12:04:44 +01:00
Volker Lendecke
98f830cdfc Disable the use of splice(2)
On a debian lenny installation with a kernel that calls itself 2.6.28, I could
repeatably block smbd using splice. According to the output of netstat, the
recvq of the TCP connection was full and at the same time according to strace
smbd was stuck in a splice syscall trying to read from that TCP connection. We
can not protect ourselves from this condition, as nobody will ever notify us
that something is broken. So sadly we can't use splice yet at all. Maybe in
2.6.29...
2008-12-31 19:33:25 +01:00
Volker Lendecke
e0fd61f0cb Try to fix recvfile using splice on Linux
According to the splice(2) manpage, one of the file descriptors *must* be a
pipe. With this patch I could successfully run splice(2) on a debian lenny
installation.

Jeremy, please check!
2008-12-31 19:33:25 +01:00
Jeremy Allison
8ca459e067 Fix bug #5477 - recvfile code was broken.
Jeremy.
(This used to be commit 830337f054)
2008-05-20 12:09:48 -07:00
Jeremy Allison
82572cfd43 Enable tests for splice on Linux. Add a static (vl, I hate this)
so we can detect broken Linux recvfile splice and correctly fall
back.
Jeremy.
(This used to be commit ec2d301a7a)
2008-05-06 15:44:39 -07:00
Jeremy Allison
133fad90b5 Make explicit draining the socket on RECVFILE. Add
capability for large UNIX write if not signing and
recvfile set. Cope with large UNIX write length on
incoming processing. Stevef - we can now test 1-16Mb
writes from CIFFS.
Jeremy.
(This used to be commit 8cf78776b0)
2007-10-31 14:01:35 -07:00
Jeremy Allison
ff82c0a037 Handle the disk full error case correctly.
Jeremy.
(This used to be commit b7088bb9c2)
2007-10-30 18:18:40 -07:00
Jeremy Allison
c3250149e1 Add new parameter, "min receivefile size" (by default set
to zero). If non-zero, writeX calls greater than this
value will be left in the socket buffer for later handling
with recvfile (or userspace equivalent). Definition of
recvfile for your system is left as an exercise for
the reader (I'm working on getting splice working :-).
Jeremy.
(This used to be commit 11c03b75dd)
2007-10-30 16:22:24 -07:00
Jeremy Allison
0af071d762 Forgot to add recvfile.c
Jeremy.
(This used to be commit d5886218e5)
2007-10-29 17:17:16 -07:00