Lines Matching refs:st

351     struct sal_socket_table *st = &socket_table;  in sal_get_socket()  local
355 if (socket < 0 || socket >= (int) st->max_socket) in sal_get_socket()
361 RT_ASSERT(st->sockets[socket]->magic == SAL_SOCKET_MAGIC); in sal_get_socket()
363 return st->sockets[socket]; in sal_get_socket()
489 static int socket_alloc(struct sal_socket_table *st, int f_socket) in socket_alloc() argument
494 for (idx = f_socket; idx < (int) st->max_socket; idx++) in socket_alloc()
496 if (st->sockets[idx] == RT_NULL) in socket_alloc()
503 if (idx == (int) st->max_socket && st->max_socket < SAL_SOCKETS_NUM) in socket_alloc()
509 cnt = st->max_socket + SOCKET_TABLE_STEP_LEN; in socket_alloc()
512 sockets = rt_realloc(st->sockets, cnt * sizeof(struct sal_socket *)); in socket_alloc()
517 for (index = st->max_socket; index < cnt; index++) in socket_alloc()
522 st->sockets = sockets; in socket_alloc()
523 st->max_socket = cnt; in socket_alloc()
527 if (idx < (int) st->max_socket && st->sockets[idx] == RT_NULL) in socket_alloc()
529 st->sockets[idx] = rt_calloc(1, sizeof(struct sal_socket)); in socket_alloc()
530 if (st->sockets[idx] == RT_NULL) in socket_alloc()
532 idx = st->max_socket; in socket_alloc()
540 static void socket_free(struct sal_socket_table *st, int idx) in socket_free() argument
544 sock = st->sockets[idx]; in socket_free()
545 st->sockets[idx] = RT_NULL; in socket_free()
552 struct sal_socket_table *st = &socket_table; in socket_new() local
558 idx = socket_alloc(st, 0); in socket_new()
561 if (idx == (int) st->max_socket) in socket_new()
567 sock = st->sockets[idx]; in socket_new()
584 struct sal_socket_table *st = &socket_table; in socket_delete() local
588 if (idx < 0 || idx >= (int) st->max_socket) in socket_delete()
597 socket_free(st, idx); in socket_delete()