Linux Hotplug development
 help / color / mirror / Atom feed
From: belle <belle.shi@yy-inc.com>
To: linux-hotplug@vger.kernel.org
Subject: Error binding udev_event socket: Address already in use
Date: Fri, 26 Feb 2010 01:09:02 +0000	[thread overview]
Message-ID: <1267146542.3803.0.camel@shili-desktop> (raw)
In-Reply-To: <1267085491.7714.4.camel@shili-desktop>

dear all:

   i wrote a program and i used the udev_event socket to receive the
udev event, the program is as follow:

    int udev_socket;
    struct sockaddr_un saddr;
    socklen_t addrlen;
    const int on = 1;
    GIOChannel *udev_channel;

    printf("net_manage_init\n");
    memset(&saddr, 0x00, sizeof(saddr));
    saddr.sun_family = AF_LOCAL;
    strcpy(&saddr.sun_path[1], "/com/yy/net_manager");
    addrlen = offsetof(struct sockaddr_un, sun_path)
+strlen(saddr.sun_path+1) + 1;

    udev_socket = socket(AF_LOCAL, SOCK_DGRAM, 0);
    if (udev_socket = -1) {
            printf("Couldn't open socket");
            return;
    }

    if (bind(udev_socket, (struct sockaddr *) &saddr, addrlen) < 0) {
            printf ("Error binding udev_event socket: %s\n",
strerror(errno));
            return;
    }

    setsockopt(udev_socket, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on));


and when i first to run my program, everything goes ok,but
after i killed my program and run it again,i find a promote of "Error
binding udev_event socket: Address already in use",and i can't receive
the udev event. and i restart the udevd daemon,but still i can't receive
the udev event, is there anyone  who can give me some advice? i have
been working on it for a long time, it really a nightmare to me, thanks
for advance



      parent reply	other threads:[~2010-02-26  1:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-25  8:11 Error binding udev_event socket: Address already in use belle
2010-02-25  9:11 ` belle
2010-02-26  1:09 ` belle [this message]

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=1267146542.3803.0.camel@shili-desktop \
    --to=belle.shi@yy-inc.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