Lines Matching defs:fd
56 * used for writing. As long as no thread reads and writes the same fd,
258 set_noblocking(int fd)
262 if ((flags = fcntl(fd, F_GETFL, 0)) < 0) {
267 if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0) {
374 int fd;
385 /* Dup fd's switching read for write */
386 if ((fd = dup(pair->pp_readfd)) < 0) {
392 op_pair->pp_writefd = fd;
394 if ((fd = dup(pair->pp_writefd)) < 0) {
400 op_pair->pp_readfd = fd;
679 * something that's a fd.
993 int fd;
996 fd = open(CTFS_ROOT "/process/template", O_RDWR);
997 if (fd == -1)
1004 err |= ct_tmpl_set_critical(fd, 0);
1005 err |= ct_tmpl_set_informative(fd, 0);
1006 err |= ct_pr_tmpl_set_fatal(fd, CT_PR_EV_HWERR);
1007 err |= ct_pr_tmpl_set_param(fd, CT_PR_PGRPONLY | CT_PR_REGENT);
1008 if (err || ct_tmpl_activate(fd)) {
1009 if (close(fd) < 0) {
1016 return (fd);
1056 close_on_exec(int fd)
1058 int flags = fcntl(fd, F_GETFD, 0);
1059 if ((flags != -1) && (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) != -1))
1068 int n, fd;
1079 fd = open(path, oflag);
1080 if (fd != -1) {
1081 if (close_on_exec(fd) == -1) {
1083 if (close(fd) < 0) {
1091 return (fd);
1097 int fd, err;
1099 fd = ips_contract_open(ctid, "all", "ctl", O_WRONLY);
1100 if (fd == -1)
1103 err = ct_ctl_abandon(fd);
1104 if (close(fd) < 0) {
1115 int fd;
1122 fd = open(path, O_CREAT|O_RDWR, 0600);
1123 if (fd < 0)
1127 if (close(fd) < 0) {
1267 int fd;
1270 fd = dp->d_data.d_desc.d_descriptor;
1272 if (close(fd) < 0) {
1347 zpd_add_listener(zoneid_t zid, int fd, int pipefd, int closefd)
1362 listener->pl_fd = fd;
1367 if (set_noblocking(fd) < 0) {
1429 * fd.