Re: CMSG_DATA man page

2017-04-03 Thread Otto Moerbeek
On Mon, Apr 03, 2017 at 09:45:06PM +0200, Otto Moerbeek wrote: > On Mon, Apr 03, 2017 at 09:27:52AM +, Luke Small wrote: > > > I'm sure you know more about it than I do. Probably the simplest answer > > would be to get rid of the example in the man page. You can google a > > correct answer. I

Re: CMSG_DATA man page

2017-04-03 Thread Otto Moerbeek
On Mon, Apr 03, 2017 at 09:27:52AM +, Luke Small wrote: > I'm sure you know more about it than I do. Probably the simplest answer > would be to get rid of the example in the man page. You can google a > correct answer. It is in several places using the same message='F'; Unless > y'all desire t

Re: CMSG_DATA man page

2017-04-03 Thread Luke Small
I'm sure you know more about it than I do. Probably the simplest answer would be to get rid of the example in the man page. You can google a correct answer. It is in several places using the same message='F'; Unless y'all desire the programmer to be able to read the man page because they may not ha

Re: CMSG_DATA man page

2017-04-03 Thread Stuart Henderson
On 2017/04/02 13:15, Luke Small wrote: (quote word-wrapped and trimmed) >Can the code be fixed to not > cause problems when msg.msg_iov is zero? At first blush, that would > seem like a simple fix to me. I assume that such a fix wouldn't break > POSIX or some

Re: CMSG_DATA man page

2017-04-02 Thread Luke Small
Would you have to specify the (msg.msg_iov)->iov_len = 0? On Sun, Apr 2, 2017 at 8:15 AM Luke Small wrote: > In the example I give: > ... > message_buffer[0] = 'F'; > io_vector[0].iov_base = message_buffer; > io_vector[0].iov_len = 1; > > memset(&msg, 0, sizeof(struct msghdr)); > msg.msg_iov = io

Re: CMSG_DATA man page

2017-04-02 Thread Luke Small
In the example I give: ... message_buffer[0] = 'F'; io_vector[0].iov_base = message_buffer; io_vector[0].iov_len = 1; memset(&msg, 0, sizeof(struct msghdr)); msg.msg_iov = io_vector; msg.msg_iovlen = 1; ... msg.msg_iov would be NULL with a memset. msg.msg_iovlen likely specifies how many are in t

Re: CMSG_DATA man page

2017-04-02 Thread Otto Moerbeek
On Sun, Apr 02, 2017 at 12:29:05PM +, Luke Small wrote: > Maybe before it is sent, iov_len can be defaulted to 0 in the example, > since it'd take an initializer like in c++ to do it otherwise(wanna put c++ > in the base! Lol). I assume it wouldn't try to read a zero length iov_base. > The pro

Re: CMSG_DATA man page

2017-04-02 Thread Luke Small
Maybe before it is sent, iov_len can be defaulted to 0 in the example, since it'd take an initializer like in c++ to do it otherwise(wanna put c++ in the base! Lol). I assume it wouldn't try to read a zero length iov_base. The problem may be that usually iov_len has a nonzero value, but the base po

Re: CMSG_DATA man page

2017-04-02 Thread Otto Moerbeek
On Sat, Apr 01, 2017 at 10:57:48AM +, Luke Small wrote: > Or put in the man page to "Google it!" Lol > On Sat, Apr 1, 2017 at 5:33 AM Otto Moerbeek wrote: > > > On Sat, Apr 01, 2017 at 12:50:46AM -0700, Philip Guenther wrote: > > > > > On Sat, 1 Apr 2017, Otto Moerbeek wrote: > > > > On Sat,

Re: CMSG_DATA man page

2017-04-01 Thread Luke Small
Or put in the man page to "Google it!" Lol On Sat, Apr 1, 2017 at 5:33 AM Otto Moerbeek wrote: > On Sat, Apr 01, 2017 at 12:50:46AM -0700, Philip Guenther wrote: > > > On Sat, 1 Apr 2017, Otto Moerbeek wrote: > > > On Sat, Apr 01, 2017 at 01:20:25AM -0500, Luke Small wrote: > > > > > > > Here are

Re: CMSG_DATA man page

2017-04-01 Thread Otto Moerbeek
On Sat, Apr 01, 2017 at 12:50:46AM -0700, Philip Guenther wrote: > On Sat, 1 Apr 2017, Otto Moerbeek wrote: > > On Sat, Apr 01, 2017 at 01:20:25AM -0500, Luke Small wrote: > > > > > Here are two programs. They both fork two clients that try to connect > > > on port 'portno' that is listened to i

Re: CMSG_DATA man page

2017-04-01 Thread Luke Small
I'd say it's a bug. But it is obviously up to you whether you want to fix it and possibly somehow suggest it for POSIX or something even. But it is obviously up to y'all to determine if there needs to even be man page love because of this. I don't feel that the example for the man page is extraordi

Re: CMSG_DATA man page

2017-04-01 Thread Philip Guenther
On Sat, 1 Apr 2017, Otto Moerbeek wrote: > On Sat, Apr 01, 2017 at 01:20:25AM -0500, Luke Small wrote: > > > Here are two programs. They both fork two clients that try to connect > > on port 'portno' that is listened to in main(). It spawns a receive > > that receives passed file descriptors pas

Re: CMSG_DATA man page

2017-04-01 Thread Otto Moerbeek
On Sat, Apr 01, 2017 at 09:12:08AM +0200, Otto Moerbeek wrote: > On Sat, Apr 01, 2017 at 01:20:25AM -0500, Luke Small wrote: > > > Here are two programs. They both fork two clients that try to connect on > > port 'portno' that is listened to in main(). It spawns a receive that > > receives passed

Re: CMSG_DATA man page

2017-04-01 Thread Otto Moerbeek
On Sat, Apr 01, 2017 at 01:20:25AM -0500, Luke Small wrote: > Here are two programs. They both fork two clients that try to connect on > port 'portno' that is listened to in main(). It spawns a receive that > receives passed file descriptors passed from main(). It passes a file > descriptor of the

Re: CMSG_DATA man page

2017-03-31 Thread Luke Small
Here are two programs. They both fork two clients that try to connect on port 'portno' that is listened to in main(). It spawns a receive that receives passed file descriptors passed from main(). It passes a file descriptor of the client connection to receive twice. server_sample0.c uses the man pa

Re: CMSG_DATA man page

2017-03-31 Thread Otto Moerbeek
On Fri, Mar 31, 2017 at 06:51:44PM +, Luke Small wrote: > I'm not asking for help. I'm suggesting a change to the man page. This code > performs the tasks performed in the existing examples better. The code on > the man page fails if you perform it a second time. This code works when > you do

Re: CMSG_DATA man page

2017-03-31 Thread Philip Guenther
On Fri, 31 Mar 2017, Luke Small wrote: > I'm not asking for help. I'm suggesting a change to the man page. How are we supposed to judge your suggestion when you don't provide enough information for us to judge whether it's better or not? Does the example code in the manpage do what it claims to

Re: CMSG_DATA man page

2017-03-31 Thread Luke Small
I'm not asking for help. I'm suggesting a change to the man page. This code performs the tasks performed in the existing examples better. The code on the man page fails if you perform it a second time. This code works when you do it twice. So if you use this code with one process sittting on a port

Re: CMSG_DATA man page

2017-03-31 Thread Otto Moerbeek
On Fri, Mar 31, 2017 at 07:45:31AM +, Luke Small wrote: > I found the code from > http://www.techdeviancy.com/uds.html, but there are many references to code > like this on google with the line: > "message_buffer[0] = 'F';". > > I made an amalgamation of that code and the EXAMPLE section of C

Re: CMSG_DATA man page

2017-03-31 Thread Luke Small
I found the code from http://www.techdeviancy.com/uds.html, but there are many references to code like this on google with the line: "message_buffer[0] = 'F';". I made an amalgamation of that code and the EXAMPLE section of CMSG_DATA(3): EXAMPLES The following example constructs a control message

Re: CMSG_DATA man page

2017-03-30 Thread Luke Small
The file descriptor is successfully sent the first time, but the second time it fails On Thu, Mar 30, 2017 at 8:55 PM Theo de Raadt wrote: > There is a bug in your brain. > > Don't you see it?? > > You yammer yammer yammer without detail. > > Don't you see it? > > Something is eating your brain.

Re: CMSG_DATA man page

2017-03-30 Thread Theo de Raadt
There is a bug in your brain. Don't you see it?? You yammer yammer yammer without detail. Don't you see it? Something is eating your brain. d > I used the example from the man page and it worked in the program only one > time in a session. I found example code on the web that introduces a on

CMSG_DATA man page

2017-03-30 Thread Luke Small
I used the example from the man page and it worked in the program only one time in a session. I found example code on the web that introduces a one byte message (that I ignore) along with the ancillary data and it works at least twice in a receiving session. Is it a bug in the implementation, the