linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Waychison <Michael.Waychison@Sun.COM>
To: linux-hotplug@vger.kernel.org
Subject: Re: [PATCH] convert udevsend/udevd to using datagram sockets
Date: Wed, 04 Feb 2004 21:06:20 +0000	[thread overview]
Message-ID: <40215ECC.2070804@sun.com> (raw)
In-Reply-To: <40209893.8080109@sympatico.ca>

Chris Friesen wrote:

> This patch does a couple of things to udevsend/udevd.  It doesn't touch
> udev itself at all.
>
> 1) It switches to using the abstract namespace.  This simplifies things
> since you don't have to go around unlinking.  When the socket goes away,
> the address is gone.
>
>  
>
<snip>

> 
> 	memset(&saddr, 0x00, sizeof(saddr));
> 	saddr.sun_family = AF_LOCAL;
>-	strcpy(saddr.sun_path, UDEVD_SOCK);
>+   saddr.sun_path[0] = 0;
>+   strcpy(saddr.sun_path+1, UDEV_SOCK_NAME);
>+	
>+   /* The size of the address is the offset of the start of the filename,
>+    * plus its length, plus one for the beginning null byte.
>+	 */
>+   addrlen = offsetof(struct sockaddr_un, sun_path) + strlen (saddr.sun_path+1) + 1;
> 
>-	unlink(UDEVD_SOCK);
>-	ssock = socket(AF_LOCAL, SOCK_STREAM, 0);
>+	ssock = socket(AF_LOCAL, SOCK_DGRAM, 0);
> 	if (ssock = -1) {
> 		dbg("error getting socket");
> 		exit(1);
> 	}
> 
>-	retval = bind(ssock, &saddr, sizeof(saddr));
>+	retval = bind(ssock, &saddr, addrlen);
> 	
>
The addrlen parameter should still be sizeof(saddr), regarless of the 
contents of the abstract namespace address.  The same would go for the 
sendto command.

-- 
Mike Waychison
Sun Microsystems, Inc.
1 (650) 352-5299 voice
1 (416) 202-8336 voice
mailto: Michael.Waychison@Sun.COM
http://www.sun.com

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NOTICE:  The opinions expressed in this email are held by me, 
and may not represent the views of Sun Microsystems, Inc.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
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

  parent reply	other threads:[~2004-02-04 21:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-04  7:00 [PATCH] convert udevsend/udevd to using datagram sockets Chris Friesen
2004-02-04 14:02 ` Kay Sievers
2004-02-04 15:34 ` chris_friesen
2004-02-04 21:06 ` Mike Waychison [this message]
2004-02-05  1:24 ` Chris Friesen
2004-02-05  2:08 ` Mike Waychison
2004-02-05  6:53 ` Chris Friesen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=40215ECC.2070804@sun.com \
    --to=michael.waychison@sun.com \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).