Deleted Added
full compact
devd.cc (147972) devd.cc (147973)
1/*-
2 * Copyright (c) 2002-2003 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

--- 20 unchanged lines hidden (view full) ---

29 */
30
31// TODO list:
32// o devd.conf and devd man pages need a lot of help:
33// - devd needs to document the unix domain socket
34// - devd.conf needs more details on the supported statements.
35
36#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2002-2003 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

--- 20 unchanged lines hidden (view full) ---

29 */
30
31// TODO list:
32// o devd.conf and devd man pages need a lot of help:
33// - devd needs to document the unix domain socket
34// - devd.conf needs more details on the supported statements.
35
36#include <sys/cdefs.h>
37__FBSDID("$FreeBSD: head/sbin/devd/devd.cc 147972 2005-07-13 17:10:47Z marcus $");
37__FBSDID("$FreeBSD: head/sbin/devd/devd.cc 147973 2005-07-13 17:28:11Z marcus $");
38
39#include <sys/param.h>
40#include <sys/socket.h>
41#include <sys/stat.h>
42#include <sys/sysctl.h>
43#include <sys/types.h>
44#include <sys/un.h>
45

--- 621 unchanged lines hidden (view full) ---

667
668 if ((fd = socket(PF_LOCAL, SOCK_STREAM, 0)) < 0)
669 err(1, "socket");
670 bzero(&sun, sizeof(sun));
671 sun.sun_family = AF_UNIX;
672 strlcpy(sun.sun_path, name, sizeof(sun.sun_path));
673 slen = SUN_LEN(&sun);
674 unlink(name);
38
39#include <sys/param.h>
40#include <sys/socket.h>
41#include <sys/stat.h>
42#include <sys/sysctl.h>
43#include <sys/types.h>
44#include <sys/un.h>
45

--- 621 unchanged lines hidden (view full) ---

667
668 if ((fd = socket(PF_LOCAL, SOCK_STREAM, 0)) < 0)
669 err(1, "socket");
670 bzero(&sun, sizeof(sun));
671 sun.sun_family = AF_UNIX;
672 strlcpy(sun.sun_path, name, sizeof(sun.sun_path));
673 slen = SUN_LEN(&sun);
674 unlink(name);
675 if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0)
676 err(1, "fcntl");
675 if (bind(fd, (struct sockaddr *) & sun, slen) < 0)
676 err(1, "bind");
677 listen(fd, 4);
678 chown(name, 0, 0); /* XXX - root.wheel */
677 if (bind(fd, (struct sockaddr *) & sun, slen) < 0)
678 err(1, "bind");
679 listen(fd, 4);
680 chown(name, 0, 0); /* XXX - root.wheel */
679 chmod(name, 0660);
681 chmod(name, 0666);
680 return (fd);
681}
682
683list<int> clients;
684
685void
686notify_clients(const char *data, int len)
687{

--- 245 unchanged lines hidden ---
682 return (fd);
683}
684
685list<int> clients;
686
687void
688notify_clients(const char *data, int len)
689{

--- 245 unchanged lines hidden ---