linux_socket.c (4f65e9cff4bb1e5dc67390de3f514f5d7ab8f2c5) linux_socket.c (bbf392d5eff073919385ecab501fdf9277d2ef68)
1/*-
2 * Copyright (c) 1995 Søren Schmidt
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 469 unchanged lines hidden (view full) ---

478bsd_to_linux_cmsg_type(int cmsg_type)
479{
480
481 switch (cmsg_type) {
482 case SCM_RIGHTS:
483 return (LINUX_SCM_RIGHTS);
484 case SCM_CREDS:
485 return (LINUX_SCM_CREDENTIALS);
1/*-
2 * Copyright (c) 1995 Søren Schmidt
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 469 unchanged lines hidden (view full) ---

478bsd_to_linux_cmsg_type(int cmsg_type)
479{
480
481 switch (cmsg_type) {
482 case SCM_RIGHTS:
483 return (LINUX_SCM_RIGHTS);
484 case SCM_CREDS:
485 return (LINUX_SCM_CREDENTIALS);
486 case SCM_TIMESTAMP:
487 return (LINUX_SCM_TIMESTAMP);
486 }
487 return (-1);
488}
489
490static int
491linux_to_bsd_msghdr(struct msghdr *bhdr, const struct l_msghdr *lhdr)
492{
493 if (lhdr->msg_controllen > INT_MAX)

--- 722 unchanged lines hidden (view full) ---

1216 struct cmsgcred *cmcred;
1217 struct l_cmsghdr *linux_cmsg = NULL;
1218 struct l_ucred linux_ucred;
1219 socklen_t datalen, outlen;
1220 struct l_msghdr linux_msg;
1221 struct iovec *iov, *uiov;
1222 struct mbuf *control = NULL;
1223 struct mbuf **controlp;
488 }
489 return (-1);
490}
491
492static int
493linux_to_bsd_msghdr(struct msghdr *bhdr, const struct l_msghdr *lhdr)
494{
495 if (lhdr->msg_controllen > INT_MAX)

--- 722 unchanged lines hidden (view full) ---

1218 struct cmsgcred *cmcred;
1219 struct l_cmsghdr *linux_cmsg = NULL;
1220 struct l_ucred linux_ucred;
1221 socklen_t datalen, outlen;
1222 struct l_msghdr linux_msg;
1223 struct iovec *iov, *uiov;
1224 struct mbuf *control = NULL;
1225 struct mbuf **controlp;
1226 struct timeval *ftmvl;
1227 l_timeval ltmvl;
1224 caddr_t outbuf;
1225 void *data;
1226 int error, i, fd, fds, *fdp;
1227
1228 error = copyin(msghdr, &linux_msg, sizeof(linux_msg));
1229 if (error != 0)
1230 return (error);
1231

--- 94 unchanged lines hidden (view full) ---

1326 cmcred = (struct cmsgcred *)data;
1327 bzero(&linux_ucred, sizeof(linux_ucred));
1328 linux_ucred.pid = cmcred->cmcred_pid;
1329 linux_ucred.uid = cmcred->cmcred_uid;
1330 linux_ucred.gid = cmcred->cmcred_gid;
1331 data = &linux_ucred;
1332 datalen = sizeof(linux_ucred);
1333 break;
1228 caddr_t outbuf;
1229 void *data;
1230 int error, i, fd, fds, *fdp;
1231
1232 error = copyin(msghdr, &linux_msg, sizeof(linux_msg));
1233 if (error != 0)
1234 return (error);
1235

--- 94 unchanged lines hidden (view full) ---

1330 cmcred = (struct cmsgcred *)data;
1331 bzero(&linux_ucred, sizeof(linux_ucred));
1332 linux_ucred.pid = cmcred->cmcred_pid;
1333 linux_ucred.uid = cmcred->cmcred_uid;
1334 linux_ucred.gid = cmcred->cmcred_gid;
1335 data = &linux_ucred;
1336 datalen = sizeof(linux_ucred);
1337 break;
1338
1339 case SCM_TIMESTAMP:
1340 if (datalen != sizeof(struct timeval)) {
1341 error = EMSGSIZE;
1342 goto bad;
1343 }
1344 ftmvl = (struct timeval *)data;
1345 ltmvl.tv_sec = ftmvl->tv_sec;
1346 ltmvl.tv_usec = ftmvl->tv_usec;
1347 data = &ltmvl;
1348 datalen = sizeof(ltmvl);
1349 break;
1334 }
1335
1336 if (outlen + LINUX_CMSG_LEN(datalen) >
1337 linux_msg.msg_controllen) {
1338 if (outlen == 0) {
1339 error = EMSGSIZE;
1340 goto bad;
1341 } else {

--- 350 unchanged lines hidden ---
1350 }
1351
1352 if (outlen + LINUX_CMSG_LEN(datalen) >
1353 linux_msg.msg_controllen) {
1354 if (outlen == 0) {
1355 error = EMSGSIZE;
1356 goto bad;
1357 } else {

--- 350 unchanged lines hidden ---