devd.cc (236388) | devd.cc (240823) |
---|---|
1/*- 2 * Copyright (c) 2002-2010 M. Warner Losh. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 49 unchanged lines hidden (view full) --- 58 */ 59 60// TODO list: 61// o devd.conf and devd man pages need a lot of help: 62// - devd needs to document the unix domain socket 63// - devd.conf needs more details on the supported statements. 64 65#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2002-2010 M. Warner Losh. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 49 unchanged lines hidden (view full) --- 58 */ 59 60// TODO list: 61// o devd.conf and devd man pages need a lot of help: 62// - devd needs to document the unix domain socket 63// - devd.conf needs more details on the supported statements. 64 65#include <sys/cdefs.h> |
66__FBSDID("$FreeBSD: head/sbin/devd/devd.cc 236388 2012-06-01 06:56:35Z dim $"); | 66__FBSDID("$FreeBSD: head/sbin/devd/devd.cc 240823 2012-09-22 12:42:51Z pjd $"); |
67 68#include <sys/param.h> 69#include <sys/socket.h> 70#include <sys/stat.h> 71#include <sys/sysctl.h> 72#include <sys/types.h> 73#include <sys/wait.h> 74#include <sys/un.h> --- 775 unchanged lines hidden (view full) --- 850 int rv; 851 int fd; 852 char buffer[DEVCTL_MAXBUF]; 853 int once = 0; 854 int server_fd, max_fd; 855 timeval tv; 856 fd_set fds; 857 | 67 68#include <sys/param.h> 69#include <sys/socket.h> 70#include <sys/stat.h> 71#include <sys/sysctl.h> 72#include <sys/types.h> 73#include <sys/wait.h> 74#include <sys/un.h> --- 775 unchanged lines hidden (view full) --- 850 int rv; 851 int fd; 852 char buffer[DEVCTL_MAXBUF]; 853 int once = 0; 854 int server_fd, max_fd; 855 timeval tv; 856 fd_set fds; 857 |
858 fd = open(PATH_DEVCTL, O_RDONLY); | 858 fd = open(PATH_DEVCTL, O_RDONLY | O_CLOEXEC); |
859 if (fd == -1) 860 err(1, "Can't open devctl device %s", PATH_DEVCTL); | 859 if (fd == -1) 860 err(1, "Can't open devctl device %s", PATH_DEVCTL); |
861 if (fcntl(fd, F_SETFD, FD_CLOEXEC) != 0) 862 err(1, "Can't set close-on-exec flag on devctl"); | |
863 server_fd = create_socket(PIPE); 864 max_fd = max(fd, server_fd) + 1; 865 while (1) { 866 if (romeo_must_die) 867 break; 868 if (!once && !dflag && !nflag) { 869 // Check to see if we have any events pending. 870 tv.tv_sec = 0; --- 203 unchanged lines hidden --- | 861 server_fd = create_socket(PIPE); 862 max_fd = max(fd, server_fd) + 1; 863 while (1) { 864 if (romeo_must_die) 865 break; 866 if (!once && !dflag && !nflag) { 867 // Check to see if we have any events pending. 868 tv.tv_sec = 0; --- 203 unchanged lines hidden --- |