net/local: extern local_generate_instance_id() interface

Change-Id: I14273d11b1fe4d6bdc15b14e32da609cc7883713
Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an 2021-06-08 22:16:10 +08:00 committed by Xiang Xiao
parent a7c9f701ef
commit 9f3f4fb558
2 changed files with 34 additions and 20 deletions

View File

@ -664,6 +664,16 @@ int local_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds);
int local_pollteardown(FAR struct socket *psock, FAR struct pollfd *fds);
/****************************************************************************
* Name: local_generate_instance_id
*
* Description:
* Generate instance ID for stream
*
****************************************************************************/
int32_t local_generate_instance_id(void);
#undef EXTERN
#ifdef __cplusplus
}

View File

@ -45,26 +45,6 @@
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: local_generate_instance_id
****************************************************************************/
static int32_t local_generate_instance_id(void)
{
static int32_t g_next_instance_id = 0;
int32_t id;
/* Called from local_connect with net_lock held. */
id = g_next_instance_id++;
if (g_next_instance_id < 0)
{
g_next_instance_id = 0;
}
return id;
}
/****************************************************************************
* Name: _local_semtake() and _local_semgive()
*
@ -216,6 +196,30 @@ errout_with_fifos:
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: local_generate_instance_id
*
* Description:
* Generate instance ID for stream
*
****************************************************************************/
int32_t local_generate_instance_id(void)
{
static int32_t g_next_instance_id = 0;
int32_t id;
/* Called from local_connect with net_lock held. */
id = g_next_instance_id++;
if (g_next_instance_id < 0)
{
g_next_instance_id = 0;
}
return id;
}
/****************************************************************************
* Name: psock_local_connect
*