/lxc/src/lxc/ |
H A D | lxclock.h | 47 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.
|
H A D | nl.h | 42 * @fd: the file descriptor of the netlink socket 48 int fd; member in struct:nl_handler
|
H A D | sync.c | 36 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 D | mainloop.c | 35 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 D | af_unix.c | 39 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 D | caps.c | 171 int fd; local 176 fd = open("/proc/sys/kernel/cap_last_cap", O_RDONLY); 177 if (fd >= 0) { 182 if ((n = read(fd, buf, 31)) >= 0) { 190 close(fd);
|
H A D | state.c | 113 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 D | initutils.c | 260 int fd; local 288 fd = open(path, open_mode, 0666); 289 if (fd < 0) 292 ret = fdopen(fd, mode); 295 close(fd);
|
H A D | monitor.c | 91 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 D | console.c | 94 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 D | lxc_monitord.c | 128 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 D | lxcutmp.c | 143 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 D | utils.h | 63 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 D | commands.c | 166 * 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 D | log.c | 298 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 D | attach.c | 243 int fd[LXC_NS_MAX]; local 255 fd[i] = -1; 259 fd[i] = lxc_preserve_ns(pid, ns_info[i].proc_name); 260 if (fd[i] < 0) { 267 close(fd[j]); 276 if (fd[i] < 0) 279 if (setns(fd[i], 0) < 0) { 283 close(fd[j]); 292 close(fd[i]); 467 int fd; local 1075 int fd; local [all...] |
/lxc/src/lxc/tools/ |
H A D | lxc_destroy.c | 206 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 D | lxc_monitor.c | 82 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 D | lxc_start.c | 63 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 D | lxc_attach.c | 253 static int login_pty(int fd) argument 256 if (ioctl(fd, TIOCSCTTY, NULL) < 0) 258 if (lxc_console_set_stdfds(fd) < 0) 260 if (fd > STDERR_FILENO) 261 close(fd);
|
H A D | lxc_usernsexec.c | 78 int fd, flags; local 83 fd = open(tty, O_RDWR | O_NONBLOCK); 84 if (fd == -1) { 89 flags = fcntl(fd, F_GETFL); 91 if (fcntl(fd, F_SETFL, flags) < 0) { 92 printf("WARN: could not set fd flags: %s\n", strerror(errno)); 97 if (fd != which) { 98 dup2(fd, which); 99 close(fd); 282 ret = readlink("/proc/self/fd/ [all...] |
/lxc/src/lxc/bdev/ |
H A D | lxcloop.c | 208 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);
|
H A D | lxcbtrfs.c | 56 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...] |
/lxc/src/tests/ |
H A D | concurrent.c | 208 int fd; local 209 fd = open("/", O_RDONLY); 210 if (fd < 0) { 216 printf("\nIteration %d/%d maxfd:%d\n", iter, iterations, fd); 217 close(fd);
|
/lxc/hooks/ |
H A D | unmount-namespace.c | 54 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);
|