aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/phonet.h
diff options
context:
space:
mode:
authorRémi Denis-Courmont <remi.denis-courmont@nokia.com>2010-10-08 00:02:02 -0400
committerDavid S. Miller <davem@davemloft.net>2010-10-08 17:09:10 -0400
commit03789f26722a15ccfe6f191e9fb3d356f2f18a1e (patch)
treea55a493a1b4804d0acafad5fd1a4a3b1100f3ff4 /include/linux/phonet.h
parent6d8e74ed377dd4cbad7ccc69300f734090e15c05 (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 'include/linux/phonet.h')
-rw-r--r--include/linux/phonet.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/include/linux/phonet.h b/include/linux/phonet.h
index 96f5625d62fa..e27cbf931740 100644
--- a/include/linux/phonet.h
+++ b/include/linux/phonet.h
@@ -38,9 +38,8 @@
38#define PNPIPE_IFINDEX 2 38#define PNPIPE_IFINDEX 2
39#define PNPIPE_CREATE 3 39#define PNPIPE_CREATE 3
40#define PNPIPE_ENABLE 4 40#define PNPIPE_ENABLE 4
41#define PNPIPE_DISABLE 5 41/* unused slot */
42#define PNPIPE_DESTROY 6 42#define PNPIPE_DESTROY 6
43#define PNPIPE_INQ 7
44 43
45#define PNADDR_ANY 0 44#define PNADDR_ANY 0
46#define PNADDR_BROADCAST 0xFC 45#define PNADDR_BROADCAST 0xFC