sock内核调用

1512 /*
1513 * System call vectors.
1514 *
1515 * Argument checking cleaned up. Saved 20% in size.
1516 * This function doesn't need to set the kernel lock because
1517 * it is set by the callees.
1518 */
1519
1520 asmlinkage long sys_socketcall(int call, unsigned long *args)
1521 {
1522 unsigned long a[6];
1523 unsigned long a0,a1;
1524 int err;
1525
1526 if(call<1||call>SYS_RECVMSG)
1527 return -EINVAL;
1528
1529 /* copy_from_user should be SMP safe. */
1530 if (copy_from_user(a, args, nargs[call]))
1531 return -EFAULT;
1532
1533 a0=a[0];
1534 a1=a[1];
1535
1536 switch(call)
1537 {
1538 case SYS_SOCKET:
1539 err = sys_socket(a0,a1,a[2]);
1540 break;
1541 case SYS_BIND:
1542 err = sys_bind(a0,(struct sockaddr *)a1, a[2]);
1543 break;
1544 case SYS_CONNECT:
1545 err = sys_connect(a0, (struct sockaddr *)a1, a[2]);
1546 break;
1547 case SYS_LISTEN:
1548 err = sys_listen(a0,a1);
1549 break;
1550 case SYS_ACCEPT:
-CtrXa-cFkD.cP Click to buy NOW! om wwEw G. G.dNoAcHu
846
1551 err = sys_accept(a0,(struct sockaddr *)a1, (int *)a[2]);
1552 break;
1553 case SYS_GETSOCKNAME:
1554 err = sys_getsockname(a0,(struct sockaddr *)a1, (int *)a[2]);
1555 break;
1556 case SYS_GETPEERNAME:
1557 err = sys_getpeername(a0, (struct sockaddr *)a1, (int *)a[2]);
1558 break;
1559 case SYS_SOCKETPAIR:
1560 err = sys_socketpair(a0,a1, a[2], (int *)a[3]);
1561 break;
1562 case SYS_SEND:
1563 err = sys_send(a0, (void *)a1, a[2], a[3]);
1564 break;
1565 case SYS_SENDTO:
1566 err = sys_sendto(a0,(void *)a1, a[2], a[3],
1567 (struct sockaddr *)a[4], a[5]);
1568 break;
1569 case SYS_RECV:
1570 err = sys_recv(a0, (void *)a1, a[2], a[3]);
1571 break;
1572 case SYS_RECVFROM:
1573 err = sys_recvfrom(a0, (void *)a1, a[2], a[3],
1574 (struct sockaddr *)a[4], (int *)a[5]);
1575 break;
1576 case SYS_SHUTDOWN:
1577 err = sys_shutdown(a0,a1);
1578 break;
1579 case SYS_SETSOCKOPT:
1580 err = sys_setsockopt(a0, a1, a[2], (char *)a[3], a[4]);
1581 break;
1582 case SYS_GETSOCKOPT:
1583 err = sys_getsockopt(a0, a1, a[2], (char *)a[3], (int *)a[4]);
1584 break;
1585 case SYS_SENDMSG:
1586 err = sys_sendmsg(a0, (struct msghdr *) a1, a[2]);
1587 break;
1588 case SYS_RECVMSG:
1589 err = sys_recvmsg(a0, (struct msghdr *) a1, a[2]);
1590 break;
1591 default:
1592 err = -EINVAL;
1593 break;
1594 }
1595 return err;
1596 }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

潘多拉的面

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值