diff options
author | Rémi Denis-Courmont <remi.denis-courmont@nokia.com> | 2010-10-08 04:02:02 +0000 |
---|---|---|
committer | Sundar Iyer <sundar.iyer@stericsson.com> | 2010-11-11 12:57:22 +0530 |
commit | da1009044b35b3785acb032aa941cc2b389ae8ad (patch) | |
tree | 42e152488306855116ee77a13a544968c6a0e702 /Documentation | |
parent | 66e8c393c766163be2b6af1313a59321bd762ecd (diff) |
Phonet: cleanup pipe enable socket option
The current code works like this:
int garbage, status;
socklen_t len = sizeof(status);
/* enable pipe */
setsockopt(fd, SOL_PNPIPE, PNPIPE_ENABLE, &garbage, sizeof(garbage));
/* disable pipe */
setsockopt(fd, SOL_PNPIPE, PNPIPE_DISABLE, &garbage, sizeof(garbage));
/* get status */
getsockopt(fd, SOL_PNPIPE, PNPIPE_INQ, &status, &len);
...which does not follow the usual socket option pattern. This patch
merges all three "options" into a single gettable&settable option,
before Linux 2.6.37 gets out:
int status;
socklen_t len = sizeof(status);
/* enable pipe */
status = 1;
setsockopt(fd, SOL_PNPIPE, PNPIPE_ENABLE, &status, sizeof(status));
/* disable pipe */
status = 0;
setsockopt(fd, SOL_PNPIPE, PNPIPE_ENABLE, &status, sizeof(status));
/* get status */
getsockopt(fd, SOL_PNPIPE, PNPIPE_ENABLE, &status, &len);
This also fixes the error code from EFAULT to ENOTCONN.
Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Cc: Kumar Sanghvi <kumar.sanghvi@stericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/networking/phonet.txt | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Documentation/networking/phonet.txt b/Documentation/networking/phonet.txt index 8589d1e5635..3eb88034eae 100644 --- a/Documentation/networking/phonet.txt +++ b/Documentation/networking/phonet.txt @@ -197,7 +197,7 @@ The implementation adds socket options at SOL_PNPIPE level: It then updates the pipe state associated with the sequenced socket to be PIPE_DISABLED. - PNPIPE_ENABLE accepts one integer value (int). If set to zero, the pipe + PNPIPE_ENABLE accepts one integer value (int). If set to zero, the pipe is disabled. If the value is non-zero, the pipe is enabled. If the pipe is not (yet) connected, ENOTCONN is error is returned. |