linux socket 分析 1

start the system ...
starting /etc/init/devices.init.sh
starting /etc/init/system.init.sh
starting /etc/init/tmpfs.init.sh
starting /etc/init/cron.conf.sh
starting /etc/init/date.conf.sh
Fri Jun 18 16:00:00 UTC 2010
starting /etc/init/hotplugd.conf.sh
Launch the hotplug service...

 ------> family is 2 ,type is 1 ,protocol is 0

 ipv4 inet_create : ------>

 -------> sock_map_fd
starting /etc/init/mouse.conf.sh
reg_sig_handler : done sig 2
reg_sig_handler : done sig 15
reg_sig_handler : done sig 11
register SIGINT action fail
reg_sig_handler : done sig 6

 

 

SYSCALL_DEFINE3(socket, int, family, int, type, int, protocol)
{
.....

 if (flags & ~(SOCK_CLOEXEC | SOCK_NONBLOCK))
  return -EINVAL;
 type &= SOCK_TYPE_MASK;

 if (SOCK_NONBLOCK != O_NONBLOCK && (flags & SOCK_NONBLOCK))
  flags = (flags & ~SOCK_NONBLOCK) | O_NONBLOCK;


 printk("\n ------> family is %d ,type is %d ,protocol is %d \n",family,type,protocol);


 retval = sock_create(family, type, protocol, &sock);


 if (retval < 0)
  goto out;

retval = sock_map_fd(sock, flags & (O_CLOEXEC | O_NONBLOCK));

...

}

 

static int inet_create(struct net *net, struct socket *sock, int protocol,
         int kern)
{

......


 loading_module = 0;
 int err;
printk("\n ipv4 inet_create : ------>\n");

 if (unlikely(!inet_ehash_secret))
  if (sock->type != SOCK_RAW && sock->type != SOCK_DGRAM)
   build_ehash_secret();

 sock->state = SS_UNCONNECTED;

....

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值