Star64_linux/tools/testing/selftests/android/ion/ipcsocket.h
Pintu Agarwal 47a18c42d9 android/ion: userspace test utility for ion buffer sharing
This is a test utility to verify ION buffer sharing in user space
between 2 independent processes.
It uses unix domain socket (with SCM_RIGHTS) as IPC to transfer an FD to
another process to share the same buffer.
This utility demonstrates how ION buffer sharing can be implemented between
two user space processes, using various heap types.

This utility is made to be run as part of kselftest framework in kernel.
The utility is verified on Ubuntu-32 bit system with Linux Kernel 4.14,
using ION system heap.

For more information about the utility please check the README file.

Signed-off-by: Pintu Agarwal <pintu.ping@gmail.com>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-11-15 08:07:53 -07:00

35 lines
861 B
C

#ifndef _IPCSOCKET_H
#define _IPCSOCKET_H
#define MAX_SOCK_NAME_LEN 64
char sock_name[MAX_SOCK_NAME_LEN];
/* This structure is responsible for holding the IPC data
* data: hold the buffer fd
* len: just the length of 32-bit integer fd
*/
struct socketdata {
int data;
unsigned int len;
};
/* This API is used to open the IPC socket connection
* name: implies a unique socket name in the system
* connecttype: implies server(0) or client(1)
*/
int opensocket(int *sockfd, const char *name, int connecttype);
/* This is the API to send socket data over IPC socket */
int sendtosocket(int sockfd, struct socketdata *data);
/* This is the API to receive socket data over IPC socket */
int receivefromsocket(int sockfd, struct socketdata *data);
/* This is the API to close the socket connection */
int closesocket(int sockfd, char *name);
#endif