UDS: add support for FIONREAD
Change-Id: I50030012b408242a86f8c55017429acdadff49d1
This commit is contained in:
parent
10a344c3fd
commit
f3d8aa65ac
@ -2,11 +2,6 @@
|
|||||||
* Unix Domain Sockets Implementation (PF_UNIX, PF_LOCAL)
|
* Unix Domain Sockets Implementation (PF_UNIX, PF_LOCAL)
|
||||||
* This code handles ioctl(2) commands to implement the socket API.
|
* This code handles ioctl(2) commands to implement the socket API.
|
||||||
* Some helper functions are also present.
|
* Some helper functions are also present.
|
||||||
*
|
|
||||||
* The entry points into this file are...
|
|
||||||
*
|
|
||||||
* uds_do_ioctl: process an IOCTL request.
|
|
||||||
* uds_clear_fds: calls vfs_put_filp for undelivered FDs.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "uds.h"
|
#include "uds.h"
|
||||||
@ -919,6 +914,20 @@ do_recvmsg(devminor_t minor, endpoint_t endpt, cp_grant_id_t grant)
|
|||||||
sizeof(struct msg_control));
|
sizeof(struct msg_control));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
do_fionread(devminor_t minor, endpoint_t endpt, cp_grant_id_t grant)
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
rc = uds_perform_read(minor, NONE, GRANT_INVALID, UDS_BUF, 1);
|
||||||
|
|
||||||
|
/* What should we do on error? Just set to zero for now. */
|
||||||
|
if (rc < 0)
|
||||||
|
rc = 0;
|
||||||
|
|
||||||
|
return sys_safecopyto(endpt, grant, 0, (vir_bytes) &rc, sizeof(rc));
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
uds_do_ioctl(devminor_t minor, unsigned long request, endpoint_t endpt,
|
uds_do_ioctl(devminor_t minor, unsigned long request, endpoint_t endpt,
|
||||||
cp_grant_id_t grant)
|
cp_grant_id_t grant)
|
||||||
@ -1046,6 +1055,14 @@ uds_do_ioctl(devminor_t minor, unsigned long request, endpoint_t endpt,
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case FIONREAD:
|
||||||
|
/*
|
||||||
|
* Get the number of bytes immediately available for reading.
|
||||||
|
*/
|
||||||
|
rc = do_fionread(minor, endpt, grant);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/*
|
/*
|
||||||
* The IOCTL command is not valid for /dev/uds -- this happens
|
* The IOCTL command is not valid for /dev/uds -- this happens
|
||||||
|
@ -2,20 +2,13 @@
|
|||||||
* Unix Domain Sockets Implementation (PF_UNIX, PF_LOCAL)
|
* Unix Domain Sockets Implementation (PF_UNIX, PF_LOCAL)
|
||||||
* This code handles requests generated by operations on /dev/uds
|
* This code handles requests generated by operations on /dev/uds
|
||||||
*
|
*
|
||||||
* The entry points into this file are...
|
* The interface to UNIX domain sockets is similar to the interface to network
|
||||||
*
|
|
||||||
* uds_unsuspend: resume a previously suspended socket call
|
|
||||||
* main: driver main loop
|
|
||||||
*
|
|
||||||
* The interface to unix domain sockets is similar to the interface to network
|
|
||||||
* sockets. There is a character device (/dev/uds) and this server is a
|
* sockets. There is a character device (/dev/uds) and this server is a
|
||||||
* 'driver' for that device.
|
* 'driver' for that device.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "uds.h"
|
#include "uds.h"
|
||||||
|
|
||||||
static ssize_t uds_perform_read(devminor_t, endpoint_t, cp_grant_id_t, size_t,
|
|
||||||
int);
|
|
||||||
static ssize_t uds_perform_write(devminor_t, endpoint_t, cp_grant_id_t, size_t,
|
static ssize_t uds_perform_write(devminor_t, endpoint_t, cp_grant_id_t, size_t,
|
||||||
int);
|
int);
|
||||||
|
|
||||||
@ -244,7 +237,7 @@ uds_select(devminor_t minor, unsigned int ops, endpoint_t endpt)
|
|||||||
return ready_ops;
|
return ready_ops;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t
|
ssize_t
|
||||||
uds_perform_read(devminor_t minor, endpoint_t endpt, cp_grant_id_t grant,
|
uds_perform_read(devminor_t minor, endpoint_t endpt, cp_grant_id_t grant,
|
||||||
size_t size, int pretend)
|
size_t size, int pretend)
|
||||||
{
|
{
|
||||||
|
@ -197,6 +197,8 @@ int uds_do_ioctl(devminor_t minor, unsigned long request, endpoint_t endpt,
|
|||||||
cp_grant_id_t grant);
|
cp_grant_id_t grant);
|
||||||
|
|
||||||
/* uds.c */
|
/* uds.c */
|
||||||
|
ssize_t uds_perform_read(devminor_t minor, endpoint_t endpt,
|
||||||
|
cp_grant_id_t grant, size_t size, int pretend);
|
||||||
void uds_unsuspend(devminor_t minor);
|
void uds_unsuspend(devminor_t minor);
|
||||||
|
|
||||||
/* vfs_uds.c */
|
/* vfs_uds.c */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user