<div dir="ltr"><p dir="ltr"><br>
29.07.2015 23:49 пользователь "Pavel Emelyanov" <<a href="mailto:xemul@parallels.com" target="_blank">xemul@parallels.com</a>> напиÑал:<br>
><br>
> On 07/29/2015 11:24 PM, Andrey Vagin wrote:<br>
><br>
> Does it pass?</p><p>No, it doesn't. We don't restore data in a socket.</p><p dir="ltr">
><br>
> > v2: add SOCK_NONBLOCK<br>
> > Signed-off-by: Andrey Vagin <<a href="mailto:avagin@openvz.org" target="_blank">avagin@openvz.org</a>><br>
> > ---<br>
> > test/zdtm.sh               | 1 +<br>
> > test/zdtm/live/static/Makefile      | 1 +<br>
> >Â test/zdtm/live/static/socket_close_data.c | 43 +++++++++++++++++++++++++++++++<br>
> >Â 3 files changed, 45 insertions(+)<br>
> >Â create mode 100644 test/zdtm/live/static/socket_close_data.c<br>
> ><br>
> > diff --git a/test/zdtm.sh b/test/zdtm.sh<br>
> > index e7c0e6f..6666ac9 100755<br>
> > --- a/test/zdtm.sh<br>
> > +++ b/test/zdtm.sh<br>
> > @@ -86,6 +86,7 @@ generate_test_list()<br>
> >Â Â Â Â Â Â Â Â static/sock_filter<br>
> >Â Â Â Â Â Â Â Â static/socket6_udp<br>
> >Â Â Â Â Â Â Â Â static/socket_udplite<br>
> > +Â Â Â Â Â Â Â static/socket_close_data<br>
> >Â Â Â Â Â Â Â Â static/selfexe00<br>
> >Â Â Â Â Â Â Â Â static/link10<br>
> >Â Â Â Â Â Â Â Â static/unlink_fstat00<br>
> > diff --git a/test/zdtm/live/static/Makefile b/test/zdtm/live/static/Makefile<br>
> > index 8e98ac8..b901296 100644<br>
> > --- a/test/zdtm/live/static/Makefile<br>
> > +++ b/test/zdtm/live/static/Makefile<br>
> > @@ -33,6 +33,7 @@ TST_NOFILEÂ =Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â \<br>
> >        socket6_udp           \<br>
> >        socket_udplite         \<br>
> >        socket_aio           \<br>
> > +       socket_close_data        \<br>
> >        packet_sock           \<br>
> >        packet_sock_mmap        \<br>
> >        sock_filter           \<br>
> > diff --git a/test/zdtm/live/static/socket_close_data.c b/test/zdtm/live/static/socket_close_data.c<br>
> > new file mode 100644<br>
> > index 0000000..a23eff6<br>
> > --- /dev/null<br>
> > +++ b/test/zdtm/live/static/socket_close_data.c<br>
> > @@ -0,0 +1,43 @@<br>
> > +#include <errno.h><br>
> > +#include <stdlib.h><br>
> > +#include <string.h><br>
> > +#include <sys/types.h><br>
> > +#include <sys/socket.h><br>
> > +<br>
> > +#include "zdtmtst.h"<br>
> > +<br>
> > +const char *test_doc = "Check one end of socketpair with data";<br>
> > +const char *test_author   = "Andrew Vagin <<a href="mailto:avagin@openvz.org" target="_blank">avagin@openvz.org</a>";<br>
> > +<br>
> > +#define MSG "hello"<br>
> > +int main(int argc, char **argv)<br>
> > +{<br>
> > +Â Â Â int sks[2], ret;<br>
> > +Â Â Â char buf[1024];<br>
> > +<br>
> > +Â Â Â test_init(argc, argv);<br>
> > +<br>
> > +Â Â Â if (socketpair(PF_UNIX, SOCK_DGRAM | SOCK_NONBLOCK, 0, sks) < 0) {<br>
> > +Â Â Â Â Â Â Â err("socketpair");<br>
> > +Â Â Â Â Â Â Â return 1;<br>
> > +Â Â Â }<br>
> > +<br>
> > +Â Â Â if (write(sks[1], MSG, sizeof(MSG)) != sizeof(MSG)) {<br>
> > +Â Â Â Â Â Â Â err("write");<br>
> > +Â Â Â Â Â Â Â return 1;<br>
> > +Â Â Â }<br>
> > +Â Â Â close(sks[1]);<br>
> > +<br>
> > +Â Â Â test_daemon();<br>
> > +Â Â Â test_waitsig();<br>
> > +<br>
> > +Â Â Â ret = read(sks[0], buf, sizeof(MSG));<br>
> > +Â Â Â buf[ret > 0 ? ret : 0] = 0;<br>
> > +Â Â Â if (ret != sizeof(MSG)) {<br>
> > +Â Â Â Â Â Â Â fail("%d: %s", ret, buf);<br>
> > +Â Â Â Â Â Â Â return 1;<br>
> > +Â Â Â }<br>
> > +<br>
> > +Â Â Â pass();<br>
> > +Â Â Â return 0;<br>
> > +}<br>
> ><br>
><br>
</p>
</div>