本文整理汇总了C++中sock_release函数的典型用法代码示例。如果您正苦于以下问题:C++ sock_release函数的具体用法?C++ sock_release怎么用?C++ sock_release使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sock_release函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: clean_socketport
/* Release the reference on the referenced socket. */
void
clean_socketport (void *arg)
{
struct sock_user *const user = arg;
__mutex_lock (&global_lock);
sock_release (user->sock);
__mutex_unlock (&global_lock);
}
开发者ID:diegonc,项目名称:console-xkb-support,代码行数:10,代码来源:socket.c
示例2: afs_open_socket
/*
* open an RxRPC socket and bind it to be a server for callback notifications
* - the socket is left in blocking mode and non-blocking ops use MSG_DONTWAIT
*/
int afs_open_socket(struct afs_net *net)
{
struct sockaddr_rxrpc srx;
struct socket *socket;
unsigned int min_level;
int ret;
_enter("");
ret = sock_create_kern(net->net, AF_RXRPC, SOCK_DGRAM, PF_INET6, &socket);
if (ret < 0)
goto error_1;
socket->sk->sk_allocation = GFP_NOFS;
/* bind the callback manager's address to make this a server socket */
memset(&srx, 0, sizeof(srx));
srx.srx_family = AF_RXRPC;
srx.srx_service = CM_SERVICE;
srx.transport_type = SOCK_DGRAM;
srx.transport_len = sizeof(srx.transport.sin6);
srx.transport.sin6.sin6_family = AF_INET6;
srx.transport.sin6.sin6_port = htons(AFS_CM_PORT);
min_level = RXRPC_SECURITY_ENCRYPT;
ret = kernel_setsockopt(socket, SOL_RXRPC, RXRPC_MIN_SECURITY_LEVEL,
(void *)&min_level, sizeof(min_level));
if (ret < 0)
goto error_2;
ret = kernel_bind(socket, (struct sockaddr *) &srx, sizeof(srx));
if (ret == -EADDRINUSE) {
srx.transport.sin6.sin6_port = 0;
ret = kernel_bind(socket, (struct sockaddr *) &srx, sizeof(srx));
}
if (ret < 0)
goto error_2;
rxrpc_kernel_new_call_notification(socket, afs_rx_new_call,
afs_rx_discard_new_call);
ret = kernel_listen(socket, INT_MAX);
if (ret < 0)
goto error_2;
net->socket = socket;
afs_charge_preallocation(&net->charge_preallocation_work);
_leave(" = 0");
return 0;
error_2:
sock_release(socket);
error_1:
_leave(" = %d", ret);
return ret;
}
开发者ID:krzk,项目名称:linux,代码行数:60,代码来源:rxrpc.c
示例3: rtl_btcoex_create_kernel_socket
u8 rtl_btcoex_create_kernel_socket(struct rtl_priv *rtlpriv, u8 is_invite) {
s8 kernel_socket_err;
struct bt_coex_info *pcoex_info = &rtlpriv->coex_info;
BTC_PRINT(BTC_MSG_SOCKET, SOCKET_CRITICAL,"%s CONNECT_PORT %d\n",__func__,CONNECT_PORT);
if(NULL == pcoex_info)
{
BTC_PRINT(BTC_MSG_SOCKET, SOCKET_CRITICAL,"coex_info: NULL\n");
return _FAIL;
}
kernel_socket_err = sock_create(PF_INET, SOCK_DGRAM, 0, &pcoex_info->udpsock);
BTC_PRINT(BTC_MSG_SOCKET, SOCKET_CRITICAL,"binding socket,err= %d\n",kernel_socket_err);
if (kernel_socket_err<0)
{
BTC_PRINT(BTC_MSG_SOCKET, SOCKET_CRITICAL,"Error during creation of socket error:%d\n",kernel_socket_err);
return _FAIL;
} else {
memset(&(pcoex_info->sin), 0, sizeof(pcoex_info->sin));
pcoex_info->sin.sin_family = AF_INET;
pcoex_info->sin.sin_port = htons(CONNECT_PORT);
pcoex_info->sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
memset(&(pcoex_info->bt_addr), 0, sizeof(pcoex_info->bt_addr));
pcoex_info->bt_addr.sin_family = AF_INET;
pcoex_info->bt_addr.sin_port = htons(CONNECT_PORT_BT);
pcoex_info->bt_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
pcoex_info->sk_store = NULL;
kernel_socket_err = pcoex_info->udpsock->ops->bind(pcoex_info->udpsock,(struct sockaddr *)&pcoex_info->sin,sizeof(pcoex_info->sin));
if(kernel_socket_err == 0){
BTC_PRINT(BTC_MSG_SOCKET, SOCKET_CRITICAL,"binding socket success\n");
pcoex_info->udpsock->sk->sk_data_ready = rtl_btcoex_recvmsg_int;
pcoex_info->sock_open |= KERNEL_SOCKET_OK;
pcoex_info->BT_attend = false;
BTC_PRINT(BTC_MSG_SOCKET, SOCKET_CRITICAL,"WIFI sending attend_req\n");
rtl_btcoex_sendmsgbysocket(rtlpriv,attend_req,sizeof(attend_req),true);
return _SUCCESS;
} else {
pcoex_info->BT_attend = false;
sock_release(pcoex_info->udpsock);
BTC_PRINT(BTC_MSG_SOCKET, SOCKET_CRITICAL,"Error binding socket: %d\n",kernel_socket_err);
return _FAIL;
}
}
}
开发者ID:4T-Shirt,项目名称:rtlwifi_new,代码行数:56,代码来源:halbtc8812a_ext.c
示例4: rds_tcp_accept_one
static int rds_tcp_accept_one(struct socket *sock)
{
struct socket *new_sock = NULL;
struct rds_connection *conn;
int ret;
struct inet_sock *inet;
ret = sock_create_lite(sock->sk->sk_family, sock->sk->sk_type,
sock->sk->sk_protocol, &new_sock);
if (ret)
goto out;
new_sock->type = sock->type;
new_sock->ops = sock->ops;
ret = sock->ops->accept(sock, new_sock, O_NONBLOCK);
if (ret < 0)
goto out;
rds_tcp_tune(new_sock);
inet = inet_sk(new_sock->sk);
rdsdebug("accepted tcp %pI4:%u -> %pI4:%u\n",
&inet->inet_saddr, ntohs(inet->inet_sport),
&inet->inet_daddr, ntohs(inet->inet_dport));
conn = rds_conn_create(inet->inet_saddr, inet->inet_daddr,
&rds_tcp_transport, GFP_KERNEL);
if (IS_ERR(conn)) {
ret = PTR_ERR(conn);
goto out;
}
/*
* see the comment above rds_queue_delayed_reconnect()
*/
if (!rds_conn_transition(conn, RDS_CONN_DOWN, RDS_CONN_CONNECTING)) {
if (rds_conn_state(conn) == RDS_CONN_UP)
rds_tcp_stats_inc(s_tcp_listen_closed_stale);
else
rds_tcp_stats_inc(s_tcp_connect_raced);
rds_conn_drop(conn);
ret = 0;
goto out;
}
rds_tcp_set_callbacks(new_sock, conn);
rds_connect_complete(conn);
new_sock = NULL;
ret = 0;
out:
if (new_sock)
sock_release(new_sock);
return ret;
}
开发者ID:3sOx,项目名称:asuswrt-merlin,代码行数:56,代码来源:tcp_listen.c
示例5: netlink_exit
static void __exit netlink_exit(void)
{
if(nl_sk != NULL)
{
sock_release(nl_sk->sk_socket);
}
printk("my netlink: self module exited\n");
}
开发者ID:qiubing,项目名称:study,代码行数:10,代码来源:netlink_k.c
示例6: hello_exit
static void __exit hello_exit(void)
{
/*
* sock_release (struct socket*)
*/
if (sp != NULL)
sock_release(sp->sk_socket);
printk(KERN_ALERT "exit!\n");
}
开发者ID:b3h3moth,项目名称:private_lkm,代码行数:10,代码来源:nethook.c
示例7: nlswitch_exit
void nlswitch_exit(void)
{
/*
* sock_release (struct socket*)
*/
if (sp != NULL)
sock_release(sp->sk_socket);
printk(KERN_ALERT "[i-keylog] nlswitch exit\n");
}
开发者ID:b3h3moth,项目名称:private_lkm,代码行数:10,代码来源:keyswitch.c
示例8: ip6_analysisi_exit
/*Clear the module*/
static void __exit ip6_analysisi_exit(void)
{
//release netlink socket
if(nl_sk != NULL){
sock_release(nl_sk->sk_socket);
}
//unregister
nf_unregister_hook(&nf_in_analysis);
PRINT("IPV6 packets receive and analysis module exit.\n");
}
开发者ID:fts2012,项目名称:netfilterIPv6Header,代码行数:11,代码来源:receive_analysis_k.c
示例9: rdma_exit
int rdma_exit(rdma_ctx_t ctx)
{
CHECK_MSG_RET(ctx->sock != 0, "Error releasing socket", -1);
sock_release(ctx->sock);
memset(ctx, 0, sizeof(struct rdma_ctx));
kfree(ctx);
return 0;
}
开发者ID:jcarreira,项目名称:disag-firebox,代码行数:10,代码来源:rdma_library.c
示例10: ks_netlink_modinit
int ks_netlink_modinit(void)
{
int err;
skb_queue_head_init(&ks_backlog);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
ks_netlink_rcv_wq = create_singlethread_workqueue("ksnl");
if (!ks_netlink_rcv_wq) {
err = -ENOMEM;
goto err_create_workqueue;
}
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
ksnl = netlink_kernel_create(NETLINK_KSTREAMER, ks_netlink_rcv);
#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
ksnl = netlink_kernel_create(NETLINK_KSTREAMER, 0,
ks_netlink_rcv, THIS_MODULE);
#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
ksnl = netlink_kernel_create(NETLINK_KSTREAMER, 0, ks_netlink_rcv,
NULL, THIS_MODULE);
#else
ksnl = netlink_kernel_create(&init_net, NETLINK_KSTREAMER, 0,
ks_netlink_rcv, NULL, THIS_MODULE);
#endif
if (!ksnl) {
err = -ENOMEM;
goto err_netlink_kernel_create;
}
netlink_set_nonroot(NETLINK_KSTREAMER, NL_NONROOT_RECV);
ks_netlink_state.mcast_seqnum = 0xBEEF;
init_rwsem(&ks_netlink_state.topology_lock);
init_timer(&ks_netlink_state.lock_timer);
ks_netlink_state.lock_timer.function = ks_lock_timeout;
ks_netlink_state.lock_timer.data = (unsigned long)&ks_netlink_state;
init_waitqueue_head(&ks_netlink_state.lock_sleep);
skb_queue_head_init(&ks_netlink_state.mcast_queue);
return 0;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
destroy_workqueue(ks_netlink_rcv_wq);
err_create_workqueue:
#endif
sock_release(ksnl->sk_socket);
err_netlink_kernel_create:
return err;
}
开发者ID:GunioRobot,项目名称:vstuff,代码行数:55,代码来源:netlink.c
示例11: p80211indicate_shutdown
/*----------------------------------------------------------------
* p80211indicate_shutdown
*
* Called during the p80211 unload to get rid of our netlink
* interface.
*
* Arguments:
* none
*
* Returns:
* nothing
*
* Call context:
* Any
----------------------------------------------------------------*/
void p80211indicate_shutdown(void)
{
struct sock *nl;
DBFENTER;
nl = nl_indicate;
nl_indicate = NULL;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,71) )
if ( nl != NULL && nl->socket != NULL) {
sock_release(nl->socket);
}
#else
if ( nl != NULL && nl->sk_socket != NULL) {
sock_release(nl->sk_socket);
}
#endif
DBFEXIT;
return;
}
开发者ID:OPSF,项目名称:uClinux,代码行数:35,代码来源:p80211req.c
示例12: inet6_close
static int inet6_close(struct sock *sk) {
assert(sk);
assert(sk->p_ops != NULL);
if (sk->p_ops->close == NULL) {
sock_release(sk);
return 0;
}
return sk->p_ops->close(sk);
}
开发者ID:Julia117,项目名称:embox,代码行数:11,代码来源:af_inet6.c
示例13: sock_create_udpserver
int sock_create_udpserver(struct socket **sock, const char *server_ipaddr, const int server_port)
{
if( -1 == sock_create_udp(sock) )
return -1;
if(-1 == sock_make_udpserver(*sock, server_ipaddr, server_port) )
{
sock_release(*sock);
return -1;
}
return 0;
}
开发者ID:passedaway,项目名称:module,代码行数:11,代码来源:omni_socket.c
示例14: run_network
static int run_network(void *data)
{
struct msghdr msg;
struct iovec iov;
mm_segment_t oldfs;
char buffer[0x200];// = "Hello";
int cc;
struct socket *csock = data;
struct nm_packet_rp *reply;
printk(KERN_INFO "NetMalloc: creating client thread\n");
while (network_is_running)
{
memset(&msg, 0, sizeof(msg));
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
msg.msg_flags = MSG_DONTWAIT;
msg.msg_iov->iov_len = sizeof(buffer);
msg.msg_iov->iov_base = buffer;
oldfs = get_fs();
set_fs(KERNEL_DS);
cc = sock_recvmsg(csock, &msg, sizeof(buffer), MSG_DONTWAIT);
set_fs(oldfs);
if (!cc)
break;
else if (cc == -EWOULDBLOCK)
schedule_timeout_interruptible(125);
else if (cc > 0)
{
printk(KERN_INFO "%d bytes received\n", cc);
reply = handle_packet((struct nm_packet_rq *) buffer, cc);
if (reply)
{
cc = sizeof(struct nm_packet_rp) + reply->data_len;
memset(&msg, 0, sizeof(msg));
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
msg.msg_flags = MSG_DONTWAIT;
msg.msg_iov->iov_len = cc;
msg.msg_iov->iov_base = reply;
oldfs = get_fs();
set_fs(KERNEL_DS);
cc = sock_sendmsg(csock, &msg, cc);
set_fs(oldfs);
printk(KERN_INFO "%d bytes sent\n", cc);
kfree(reply);
}
}
}
sock_release(csock);
printk(KERN_INFO "NetMalloc: closing client thread\n");
return 0;
}
开发者ID:anat,项目名称:kernel_net_malloc,代码行数:54,代码来源:main.c
示例15: netchar_exit
static void __exit netchar_exit(void)
{
device_destroy(nc_class, nc_dev_t);
cdev_del(nc_cdev);
class_destroy(nc_class);
unregister_chrdev_region(nc_dev_t, 1);
nc_socket->ops->shutdown(nc_socket, 0);
sock_release(nc_socket);
_PKI("exit");
}
开发者ID:asayler,项目名称:Networked-Dev-Device,代码行数:11,代码来源:netchar.c
示例16: spectral_destroy_netlink
int spectral_destroy_netlink(struct ath_softc *sc)
{
struct ath_spectral *spectral=sc->sc_spectral;
spectral->spectral_sock = NULL;
if (atomic_dec_and_test(&spectral_nl_users)) {
sock_release(spectral_nl_sock->sk_socket);
spectral_nl_sock = NULL;
}
return 0;
}
开发者ID:jorneytu,项目名称:wlan,代码行数:11,代码来源:spectral_netlink.c
示例17: mnlk_fini
static void mnlk_fini(void)
{
if(nl_sk)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
netlink_kernel_release(nl_sk);
#else
sock_release(nl_sk->sk_socket);
#endif
}
}
开发者ID:yanjinjin,项目名称:webad2.0,代码行数:11,代码来源:nf_conntrack_webad.c
示例18: turbotap_module_end
void __exit turbotap_module_end(void)
{
unsigned int i;
for_each_turbo_sock(i) {
if (turbotap_interfaces.turbotap_sf[i]->turbotap_sock)
sock_release(turbotap_interfaces.turbotap_sf[i]->turbotap_sock);
}
misc_deregister(&turbotap_tun_miscdev);
printk(KERN_INFO "turbotap module exit\n");
}
开发者ID:mohsinkazmi,项目名称:turbotap,代码行数:12,代码来源:turbotap.c
示例19: net_family_lookup
struct sock *sock_create(int family, int type, int protocol) {
int ret;
struct sock *new_sk;
const struct net_family *nfamily;
const struct net_family_type *nftype;
const struct net_sock *nsock;
nfamily = net_family_lookup(family);
if (nfamily == NULL) {
return err_ptr(EAFNOSUPPORT);
}
nftype = net_family_type_lookup(nfamily, type);
if (nftype == NULL) {
return err_ptr(EPROTOTYPE);
}
nsock = net_sock_lookup(family, type, protocol);
if (nsock == NULL) {
return err_ptr(EPROTONOSUPPORT);
}
new_sk = sock_alloc(nftype->ops, nsock->ops);
if (new_sk == NULL) {
return err_ptr(ENOMEM);
}
sock_init(new_sk, family, type, nsock->protocol,
nftype->ops, nsock->ops,
nfamily->out_ops != NULL ? *nfamily->out_ops : NULL);
assert(new_sk->f_ops != NULL);
ret = new_sk->f_ops->init(new_sk);
if (ret != 0) {
sock_release(new_sk);
return err_ptr(-ret);
}
assert(new_sk->p_ops != NULL);
if (new_sk->p_ops->init != NULL) {
ret = new_sk->p_ops->init(new_sk);
if (ret != 0) {
sock_close(new_sk);
return err_ptr(-ret);
}
}
sock_hash(new_sk);
return new_sk;
}
开发者ID:carriercomm,项目名称:embox,代码行数:52,代码来源:sock_factory.c
示例20: StopListening
void StopListening(void)
{
struct socket *sock;
EnterFunction("StopListening");
if (MainSocket==NULL) return;
sock=MainSocket;
MainSocket = NULL;
sock_release(sock);
LeaveFunction("StopListening");
}
开发者ID:ProjectZeroSlackr,项目名称:linux-2.4.32-ipod,代码行数:13,代码来源:sockets.c
注:本文中的sock_release函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论