Lines Matching refs:scm
110 #include <net/scm.h>
127 static void unix_get_secdata(struct scm_cookie *scm, struct sk_buff *skb)
129 memcpy(UNIXSID(skb), &scm->secid, sizeof(u32));
132 static inline void unix_set_secdata(struct scm_cookie *scm, struct sk_buff *skb)
134 scm->secid = *UNIXSID(skb);
137 static inline void unix_get_secdata(struct scm_cookie *scm, struct sk_buff *skb)
140 static inline void unix_set_secdata(struct scm_cookie *scm, struct sk_buff *skb)
1310 static void unix_detach_fds(struct scm_cookie *scm, struct sk_buff *skb)
1314 scm->fp = UNIXCB(skb).fp;
1317 for (i = scm->fp->count-1; i >= 0; i--)
1318 unix_notinflight(scm->fp->fp[i]);
1323 struct scm_cookie scm;
1324 memset(&scm, 0, sizeof(scm));
1325 scm.pid = UNIXCB(skb).pid;
1326 scm.cred = UNIXCB(skb).cred;
1328 unix_detach_fds(&scm, skb);
1332 scm_destroy(&scm);
1338 static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb)
1344 for (i = scm->fp->count - 1; i >= 0; i--) {
1345 struct sock *sk = unix_get_socket(scm->fp->fp[i]);
1361 UNIXCB(skb).fp = scm_fp_dup(scm->fp);
1366 for (i = scm->fp->count - 1; i >= 0; i--)
1367 unix_inflight(scm->fp->fp[i]);
1372 static int unix_scm_to_skb(struct scm_cookie *scm, struct sk_buff *skb, bool send_fds)
1375 UNIXCB(skb).pid = get_pid(scm->pid);
1376 UNIXCB(skb).cred = get_cred(scm->cred);
1378 if (scm->fp && send_fds)
1379 err = unix_attach_fds(scm, skb);
1406 if (NULL == siocb->scm)
1407 siocb->scm = &tmp_scm;
1409 err = scm_send(sock, msg, siocb->scm);
1442 err = unix_scm_to_skb(siocb->scm, skb, true);
1446 unix_get_secdata(siocb->scm, skb);
1530 scm_destroy(siocb->scm);
1540 scm_destroy(siocb->scm);
1559 if (NULL == siocb->scm)
1560 siocb->scm = &tmp_scm;
1562 err = scm_send(sock, msg, siocb->scm);
1620 err = unix_scm_to_skb(siocb->scm, skb, !fds_sent);
1648 scm_destroy(siocb->scm);
1649 siocb->scm = NULL;
1661 scm_destroy(siocb->scm);
1662 siocb->scm = NULL;
1741 if (!siocb->scm) {
1742 siocb->scm = &tmp_scm;
1745 scm_set_cred(siocb->scm, UNIXCB(skb).pid, UNIXCB(skb).cred);
1746 unix_set_secdata(siocb->scm, skb);
1750 unix_detach_fds(siocb->scm, skb);
1765 siocb->scm->fp = scm_fp_dup(UNIXCB(skb).fp);
1769 scm_recv(sock, msg, siocb->scm, flags);
1845 if (!siocb->scm) {
1846 siocb->scm = &tmp_scm;
1895 if ((UNIXCB(skb).pid != siocb->scm->pid) ||
1896 (UNIXCB(skb).cred != siocb->scm->cred)) {
1902 scm_set_cred(siocb->scm, UNIXCB(skb).pid, UNIXCB(skb).cred);
1927 unix_detach_fds(siocb->scm, skb);
1937 if (siocb->scm->fp)
1943 siocb->scm->fp = scm_fp_dup(UNIXCB(skb).fp);
1952 scm_recv(sock, msg, siocb->scm, flags);