From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hannes Reinecke Date: Fri, 14 Jan 2005 10:55:21 +0000 Subject: Re: [PATCH] use uevents in udevd Message-Id: <41E7A519.7030706@suse.de> MIME-Version: 1 Content-Type: multipart/mixed; boundary="------------000009090504030102080709" List-Id: References: <41E79D7A.2060607@suse.de> In-Reply-To: <41E79D7A.2060607@suse.de> To: linux-hotplug@vger.kernel.org This is a multi-part message in MIME format. --------------000009090504030102080709 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Marco d'Itri wrote: > On Jan 14, Hannes Reinecke wrote: >=20 >=20 >>Comments welcome. >=20 > Nice work. > How can the init scripts determine if support for uevents is available? >=20 Good question. Asked myself the same one just now. I couldn't figure out whether this information is exported from the=20 kernel directly, so that leaves two possibilities: - check /proc/config.gz for CONFIG_KOBJECT_UEVENT (if /proc/config.gz is available) - use a program to check for it (like the attached one). HTH, Hannes --=20 Dr. Hannes Reinecke hare@suse.de SuSE Linux AG S390 & zSeries Maxfeldstra=C3=9Fe 5 +49 911 74053 688 90409 N=C3=BCrnberg http://www.suse.de --------------000009090504030102080709 Content-Type: text/x-csrc; name="uevent_check.c" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="uevent_check.c" /* * uevent_check.c - check for uevent socket * * based on uevent_listen.c * * Copyright (C) 2004 Kay Sievers * Copyright (C) 2004 Hannes Reinecke * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation version 2 of the License. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 675 Mass Ave, Cambridge, MA 02139, USA. * */ #include #include #include #include #include #include #include #include #include #include int main(int argc, char *argv[]) { int sock; struct sockaddr_nl snl; int retval; if (getuid() != 0) { fprintf(stderr,"need to be root, exit\n"); exit(0); } memset(&snl, 0x00, sizeof(struct sockaddr_nl)); snl.nl_family = AF_NETLINK; snl.nl_pid = getpid(); snl.nl_groups = 0xffffffff; sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT); if (sock == -1) { fprintf(stderr,"error getting socket, exit\n"); exit(1); } retval = bind(sock, (struct sockaddr *) &snl, sizeof(struct sockaddr_nl)); if (retval < 0) { fprintf("bind failed, exit\n"); exit(1); } fprintf(stderr,"uevent socket available"); exit(0); } --------------000009090504030102080709-- ------------------------------------------------------- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel