Searched refs:fd (Results 1 - 25 of 51) sorted by relevance

123

/lxc/src/lxc/
H A Daf_unix.h29 extern int lxc_abstract_unix_close(int fd);
32 extern int lxc_abstract_unix_send_fd(int fd, int sendfd, void *data, size_t size);
33 extern int lxc_abstract_unix_recv_fd(int fd, int *recvfd, void *data, size_t size);
34 extern int lxc_abstract_unix_send_credential(int fd, void *data, size_t size);
35 extern int lxc_abstract_unix_rcv_credential(int fd, void *data, size_t size);
H A Dmainloop.h35 typedef int (*lxc_mainloop_callback_t)(int fd, uint32_t event, void *data,
40 extern int lxc_mainloop_add_handler(struct lxc_epoll_descr *descr, int fd,
44 extern int lxc_mainloop_del_handler(struct lxc_epoll_descr *descr, int fd);
H A Daf_unix.c39 int fd; local
46 fd = socket(PF_UNIX, type, 0);
47 if (fd < 0)
54 return fd;
61 close(fd);
68 if (bind(fd, (struct sockaddr *)&addr, offsetof(struct sockaddr_un, sun_path) + len + 1)) {
70 close(fd);
75 if (type == SOCK_STREAM && listen(fd, 100)) {
77 close(fd);
82 return fd;
85 lxc_abstract_unix_close(int fd) argument
101 int fd; local
136 lxc_abstract_unix_send_fd(int fd, int sendfd, void *data, size_t size) argument
166 lxc_abstract_unix_recv_fd(int fd, int *recvfd, void *data, size_t size) argument
205 lxc_abstract_unix_send_credential(int fd, void *data, size_t size) argument
238 lxc_abstract_unix_rcv_credential(int fd, void *data, size_t size) argument
[all...]
H A Dconsole.h61 * @sockfd : the socket fd whose remote side when closed, will be an
85 * - close master/slave pty pair and allocated fd for the peer (usually
96 * @fd : the socket fd whose remote side was closed, which indicated
100 extern void lxc_console_free(struct lxc_conf *conf, int fd);
127 * fd to the allocated pty.
135 * Make fd a duplicate of the standard file descriptors:
136 * fd is made a duplicate of a specific standard file descriptor iff the
139 extern int lxc_console_set_stdfds(int fd);
142 * Handler for events on the stdin fd o
[all...]
H A Dmonitor.c91 int fd,ret; local
103 fd = open(fifo_path, O_WRONLY | O_NONBLOCK);
104 if (fd < 0) {
115 if (fcntl(fd, F_SETFL, O_WRONLY) < 0) {
116 close(fd);
120 ret = write(fd, msg, sizeof(*msg));
122 close(fd);
127 close(fd);
151 int lxc_monitor_close(int fd) argument
153 return close(fd);
209 int fd; local
287 lxc_monitor_read_timeout(int fd, struct lxc_msg *msg, int timeout) argument
298 lxc_monitor_read(int fd, struct lxc_msg *msg) argument
[all...]
H A Dmainloop.c35 int fd; member in struct:mainloop_handler
62 if (handler->callback(handler->fd, events[i].events,
75 int lxc_mainloop_add_handler(struct lxc_epoll_descr *descr, int fd, argument
87 handler->fd = fd;
93 if (epoll_ctl(descr->epfd, EPOLL_CTL_ADD, fd, &ev) < 0)
109 int lxc_mainloop_del_handler(struct lxc_epoll_descr *descr, int fd) argument
117 if (handler->fd == fd) {
119 if (epoll_ctl(descr->epfd, EPOLL_CTL_DEL, fd, NUL
[all...]
H A Dsync.c36 static int __sync_wait(int fd, int sequence) argument
41 ret = read(fd, &sync, sizeof(sync));
69 static int __sync_wake(int fd, int sequence) argument
73 if (write(fd, &sync, sizeof(sync)) < 0) {
80 static int __sync_barrier(int fd, int sequence) argument
82 if (__sync_wake(fd, sequence))
84 return __sync_wait(fd, sequence+1);
H A Dcommands.c166 * here as it contains an fd for the master pty passed through the
233 * @fd : file descriptor of socket to send response on
238 static int lxc_cmd_rsp_send(int fd, struct lxc_cmd_rsp *rsp) argument
242 ret = send(fd, rsp, sizeof(*rsp), 0);
250 ret = send(fd, rsp->data, rsp->datalen, 0);
272 * the fd cannot be closed because it is used as a placeholder to indicate
273 * that a particular tty slot is in use. The fd is also used as a signal to
274 * the container that when the caller dies or closes the fd, the container
275 * will notice the fd on its side of the socket in its mainloop select and
276 * then free the slot with lxc_cmd_fd_cleanup(). The socket fd wil
402 lxc_cmd_get_init_pid_callback(int fd, struct lxc_cmd_req *req, struct lxc_handler *handler) argument
432 lxc_cmd_get_clone_flags_callback(int fd, struct lxc_cmd_req *req, struct lxc_handler *handler) argument
482 lxc_cmd_get_cgroup_callback(int fd, struct lxc_cmd_req *req, struct lxc_handler *handler) argument
531 lxc_cmd_get_config_item_callback(int fd, struct lxc_cmd_req *req, struct lxc_handler *handler) argument
590 lxc_cmd_get_state_callback(int fd, struct lxc_cmd_req *req, struct lxc_handler *handler) argument
636 lxc_cmd_stop_callback(int fd, struct lxc_cmd_req *req, struct lxc_handler *handler) argument
683 lxc_cmd_console_winch_callback(int fd, struct lxc_cmd_req *req, struct lxc_handler *handler) argument
703 lxc_cmd_console(const char *name, int *ttynum, int *fd, const char *lxcpath) argument
742 lxc_cmd_console_callback(int fd, struct lxc_cmd_req *req, struct lxc_handler *handler) argument
794 lxc_cmd_get_name_callback(int fd, struct lxc_cmd_req *req, struct lxc_handler *handler) argument
832 lxc_cmd_get_lxcpath_callback(int fd, struct lxc_cmd_req *req, struct lxc_handler *handler) argument
846 lxc_cmd_process(int fd, struct lxc_cmd_req *req, struct lxc_handler *handler) argument
871 lxc_cmd_fd_cleanup(int fd, struct lxc_handler *handler, struct lxc_epoll_descr *descr) argument
879 lxc_cmd_handler(int fd, uint32_t events, void *data, struct lxc_epoll_descr *descr) argument
944 lxc_cmd_accept(int fd, uint32_t events, void *data, struct lxc_epoll_descr *descr) argument
983 int fd; local
1020 int ret, fd = handler->conf->maincmd_fd; local
[all...]
H A Dlxcutmp.c143 static int utmp_shutdown_handler(int fd, uint32_t events, void *data,
150 static int utmp_handler(int fd, uint32_t events, void *data, argument
165 if (ioctl(fd, FIONREAD, &size) < 0) {
170 if (read(fd, buffer, size) < size) {
311 int fd, wd; local
353 fd = inotify_init();
354 if (fd < 0) {
359 if (fcntl(fd, F_SETFD, FD_CLOEXEC)) {
360 SYSERROR("failed to set inotify fd to close-on-exec");
365 wd = inotify_add_watch(fd, pat
393 utmp_shutdown_handler(int fd, uint32_t events, void *data, struct lxc_epoll_descr *descr) argument
433 int fd, result; local
[all...]
H A Dlxc_monitord.c128 static void lxc_monitord_sockfd_remove(struct lxc_monitor *mon, int fd) { argument
131 if (lxc_mainloop_del_handler(&mon->descr, fd))
132 CRIT("File descriptor %d not found in mainloop.", fd);
133 close(fd);
136 if (mon->clientfds[i] == fd)
140 CRIT("File descriptor %d not found in clients array.", fd);
150 static int lxc_monitord_sock_handler(int fd, uint32_t events, void *data, argument
159 rc = read(fd, buf, sizeof(buf));
165 lxc_monitord_sockfd_remove(mon, fd);
169 static int lxc_monitord_sock_accept(int fd, uint32_ argument
234 int fd; local
291 lxc_monitord_fifo_handler(int fd, uint32_t events, void *data, struct lxc_epoll_descr *descr) argument
[all...]
H A Dmonitor.h56 * The function will return an fd corresponding to the events
63 * @fd : the file descriptor provided by lxc_monitor_open
68 extern int lxc_monitor_read(int fd, struct lxc_msg *msg);
72 * @fd : the file descriptor provided by lxc_monitor_open
78 extern int lxc_monitor_read_timeout(int fd, struct lxc_msg *msg, int timeout);
H A Dconsole.c94 int lxc_console_cb_sigwinch_fd(int fd, uint32_t events, void *cbdata, argument
100 ssize_t ret = read(fd, &siginfo, sizeof(siginfo));
144 DEBUG("%d got SIGWINCH fd %d", getpid(), ts->sigfd);
158 static int lxc_console_cb_con(int fd, uint32_t events, void *data, argument
165 w = r = lxc_read_nointr(fd, buf, sizeof(buf));
167 INFO("console client on fd %d has exited", fd);
168 lxc_mainloop_del_handler(descr, fd);
169 close(fd);
173 if (fd
245 lxc_setup_tios(int fd, struct termios *oldtios) argument
401 lxc_console_free(struct lxc_conf *conf, int fd) argument
422 int fd; local
569 lxc_console_set_stdfds(int fd) argument
595 lxc_console_cb_tty_stdin(int fd, uint32_t events, void *cbdata, struct lxc_epoll_descr *descr) argument
626 lxc_console_cb_tty_master(int fd, uint32_t events, void *cbdata, struct lxc_epoll_descr *descr) argument
[all...]
H A Dlxclock.c186 l->u.f.fd = -1;
227 if (l->u.f.fd == -1) {
228 l->u.f.fd = open(l->u.f.fname, O_RDWR|O_CREAT,
230 if (l->u.f.fd == -1) {
239 ret = fcntl(l->u.f.fd, F_SETLKW, &lk);
265 if (l->u.f.fd != -1) {
270 ret = fcntl(l->u.f.fd, F_SETLK, &lk);
273 close(l->u.f.fd);
274 l->u.f.fd = -1;
304 if (l->u.f.fd !
[all...]
H A Dstate.c113 int s[MAX_STATE] = {0}, fd; local
121 fd = lxc_monitor_open(lxcpath);
122 if (fd < 0)
150 if (lxc_monitor_read_timeout(fd, &msg, timeout) < 0) {
195 lxc_monitor_close(fd);
H A Dnl.c195 ret = recvmsg(handler->fd, &msg, 0);
232 ret = sendmsg(handler->fd, &msg, 0);
272 handler->fd = socket(AF_NETLINK, SOCK_RAW, protocol);
273 if (handler->fd < 0)
276 if (setsockopt(handler->fd, SOL_SOCKET, SO_SNDBUF,
280 if (setsockopt(handler->fd, SOL_SOCKET, SO_RCVBUF,
288 if (bind(handler->fd, (struct sockaddr*)&handler->local,
293 if (getsockname(handler->fd, (struct sockaddr*)&handler->local,
313 close(handler->fd);
319 close(handler->fd);
[all...]
H A Dutils.h63 static inline int setns(int fd, int nstype) argument
66 return syscall(__NR_setns, fd, nstype);
68 return syscall(__NR_set_ns, fd, nstype);
160 static inline int signalfd(int fd, const sigset_t *mask, int flags) argument
164 retval = syscall (__NR_signalfd4, fd, mask, _NSIG / 8, flags);
166 retval = syscall (__NR_signalfd, fd, mask, _NSIG / 8);
239 extern ssize_t lxc_write_nointr(int fd, const void* buf, size_t count);
240 extern ssize_t lxc_read_nointr(int fd, void* buf, size_t count);
241 extern ssize_t lxc_read_nointr_expect(int fd, void* buf, size_t count, const void* expected_buf);
294 extern void *lxc_strmmap(void *addr, size_t length, int prot, int flags, int fd,
[all...]
H A Dlog.c298 int fd; local
301 fd = lxc_unpriv(open(name, O_CREAT | O_WRONLY |
303 if (fd == -1) {
309 if (fd > 2)
310 return fd;
312 newfd = fcntl(fd, F_DUPFD_CLOEXEC, 3);
314 ERROR("failed to dup log fd %d : %s", fd, strerror(errno));
316 close(fd);
547 extern int lxc_log_set_file(int *fd, cons argument
[all...]
H A Dlxclock.h47 int fd; //!< fd on which a lock is held (if not -1) member in struct:lxc_lock::__anon15::__anon16
77 * freed when the container is freed), and \c u.f.fd = -1.
/lxc/src/lxc/tools/
H A Dlxc_monitor.c82 close(fds[i].fd);
111 int fd; local
113 fd = lxc_monitor_open(my_args.lxcpath[i]);
114 if (fd < 0) {
119 if (write(fd, "quit", 4) < 0) {
122 close(fd);
125 close(fd);
155 int fd; local
159 fd = lxc_monitor_open(my_args.lxcpath[i]);
160 if (fd <
[all...]
H A Dlxc_start.c63 int err = -1, fd; local
68 fd = creat(path, 0600);
69 if (fd < 0 && errno != EEXIST) {
73 if (fd >= 0)
74 close(fd);
131 int fd; local
135 fd = open(path, O_RDONLY);
136 if (fd < 0) {
140 return fd;
347 int fd local
[all...]
H A Dlxc_destroy.c206 int fd; local
215 fd = open(path, O_RDONLY | O_CLOEXEC);
216 if (fd >= 0) {
217 ret = fstat(fd, &fbuf);
219 close(fd);
227 close(fd);
231 ret = read(fd, buf, fbuf.st_size);
234 close(fd);
238 close(fd);
H A Dlxc-start-ephemeral.in230 with open("/proc/filesystems", "r") as fd:
231 for line in fd:
236 with open(os.path.join(dest_path, "pre-mount"), "w+") as fd:
237 os.fchmod(fd.fileno(), 0o755)
238 fd.write("""#!/bin/sh
247 fd.write("mkdir -p %s\n" % (tmpdir))
249 fd.write("mount -n -t tmpfs -o mode=0755 none %s\n" % (tmpdir))
252 fd.write("mkdir -p %s %s\n" % (deltdir, entry[1]))
254 fd.write("mkdir -p %s\n" % workdir)
256 fd
[all...]
/lxc/src/lxc/bdev/
H A Dlxcbtrfs.c56 char *get_btrfs_subvol_path(int fd, u64 dir_id, u64 objid, char *name, argument
68 ret = ioctl(fd, BTRFS_IOC_INO_LOOKUP, &args);
109 int btrfs_list_get_path_rootid(int fd, u64 *treeid) argument
117 ret = ioctl(fd, BTRFS_IOC_INO_LOOKUP, &args);
129 int fd, ret; local
133 fd = open(path, O_RDONLY);
134 if (fd < 0)
138 ret = ioctl(fd, BTRFS_IOC_SPACE_INFO, &sargs);
139 close(fd);
223 int ret, fd local
301 int fd = -1, fddst = -1, ret = -1; local
414 int ret, fd = -1; local
592 int fd; local
[all...]
H A Dlxcloop.c208 int fd, ret; local
210 fd = creat(path, S_IRUSR|S_IWUSR);
211 if (fd < 0)
213 if (lseek(fd, size, SEEK_SET) < 0) {
215 close(fd);
218 if (write(fd, "1", 1) != 1) {
220 close(fd);
223 ret = close(fd);
/lxc/hooks/
H A Dunmount-namespace.c54 static inline int setns(int fd, int nstype) argument
57 return syscall(__NR_setns, fd, nstype);
59 return syscall(__NR_set_ns, fd, nstype);
99 int fd; local
114 fd = openat(procfd, "self/mounts", O_RDONLY);
115 if (fd < 0) {
120 mf = fdopen(fd, "r");
123 close(fd);

Completed in 39 milliseconds

123