Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 951875 Details for
Bug 1152478
Execute QMP: "getfd.." will show error: No file descriptor supplied via SCM_RIGHTS
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
fixed pass-fd program
pass-fd.c (text/x-csrc), 1.47 KB, created by
Luiz Capitulino
on 2014-10-29 18:05:37 UTC
(
hide
)
Description:
fixed pass-fd program
Filename:
MIME Type:
Creator:
Luiz Capitulino
Created:
2014-10-29 18:05:37 UTC
Size:
1.47 KB
patch
obsolete
>#include <stdio.h> >#include <unistd.h> >#include <errno.h> >#include <string.h> >#include <fcntl.h> >#include <stdlib.h> >#include <sys/stat.h> >#include <sys/types.h> >#include <sys/socket.h> >#include <sys/un.h> > >int main(int argc, char *argv[]) >{ > char c, control[CMSG_SPACE(sizeof(int))]; > int err, filefd, sockfd; > struct sockaddr_un addr; > struct cmsghdr *cmsg; > struct iovec iov[1]; > struct msghdr msg; > > if (argc != 3) { > printf("usage: pass-fd < file to pass > < qmp socket >\n"); > exit(1); > } > > filefd = open(argv[1], O_RDWR); > if (filefd < 0) { > perror("open()"); > exit(1); > } > > sockfd = socket(AF_UNIX, SOCK_STREAM, 0); > if (sockfd < 0) { > perror("socket()"); > exit(1); > } > > memset(&addr, 0, sizeof(addr)); > addr.sun_family = AF_UNIX; > strcpy(addr.sun_path, argv[2]); > err = connect(sockfd, (const struct sockaddr *) &addr, sizeof(addr)); > if (err < 0) { > perror("connect()"); > exit(1); > } > > memset(&msg, 0, sizeof(msg)); > memset(control, 0, sizeof(control)); > > iov[0].iov_base = &c; > iov[0].iov_len = 1; > > msg.msg_iov = iov; > msg.msg_iovlen = 1; > > msg.msg_control = control; > msg.msg_controllen = sizeof(control); > > cmsg = CMSG_FIRSTHDR(&msg); > cmsg->cmsg_len = CMSG_LEN(sizeof(int)); > cmsg->cmsg_level = SOL_SOCKET; > cmsg->cmsg_type = SCM_RIGHTS; > memcpy(CMSG_DATA(cmsg), &filefd, sizeof(int)); > > do { > err = sendmsg(sockfd, &msg, 0); > } while (err < 0 && errno == EINTR); > > printf("sent fd %d\n", filefd); > pause(); > > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1152478
:
946767
| 951875