hi ppl,<br> i am new to this topic, and could not find much details of what i was searching for, so that this would be the right place to mail Iin case it aint, please guide me )...<br><br>i wanted to know who does the mounting of hotpluged devices? i know that halddaemon broacasts the message on Dbus wen a new device is added and the callouts for the device is completed and the /proc/mount tree is changed. but who reads the messages from Dbus, is it gnome-volume-manager or gnome-mount? if it is the manager, i could not find that part of the code in the sources which does the mounting...
<br><br><br>also, i tried reading messages from udev by killing the systems hald and reading the mesages by creating a local socket.. code is as under, but it doesnt seem to work..<br><br>static gboolean hald_udev_data(GIOChannel *source, GIOCondition condition, gpointer user_data)
<br>{<br> int fd;<br> int retval;<br> struct msghdr smsg;<br> struct cmsghdr *cmsg;<br> struct iovec iov;<br> struct ucred *cred;<br> char cred_msg[CMSG_SPACE(sizeof(struct ucred))];<br>
<br> char buf[4096];<br> size_t bufpos = 0;<br> const char *action = NULL;<br> memset(buf, 0x00, sizeof (buf));<br><br> fd = g_io_channel_unix_get_fd (source);<br><br> iov.iov_base = &buf;
<br> iov.iov_len = sizeof (buf);<br><br> memset(&smsg, 0x00, sizeof (struct msghdr));<br> smsg.msg_iov = &iov;<br> smsg.msg_iovlen = 1;<br> smsg.msg_control = cred_msg;<br> smsg.msg_controllen
= sizeof (cred_msg);<br> retval = recvmsg (fd, &smsg, 0);<br> if(retval==-1){<br> syslog("\nError recieving mesage from udev--my hald");<br> }<br> syslog("Recieved message is: %s --my hald",(char *)smsg.msg_iov->iov_base);
<br><br> return TRUE;<br><br><br>}<br><br>void osspec_init()<br>{<br> int udev_socket,on=1;<br> struct sockaddr_un saddr;<br> GIOChannel *udev_channel;<br> socklen_t addrlen;<br> memset(&saddr,0x00,sizeof(saddr));
<br><br> saddr.sun_family=AF_LOCAL;<br> strcpy(&saddr.sun_path[1],"/org/freedesktop/hal/udev_event");<br> addrlen=offsetof(struct sockaddr_un,sun_path) + strlen(saddr.sun_path + 1);<br><br>
udev_socket=socket(AF_LOCAL,SOCK_DGRAM,0);<br> if(udev_socket<0){<br> printf("Error creating socket");<br> exit(0);<br> }<br> printf("\nSocket created..");
<br> if((bind(udev_socket,(struct sockaddr *) &saddr,addrlen))<0){<br> printf("\nError binding socket..");<br> exit(1);<br> }<br> /* enable receiving of the sender credentials */
<br> setsockopt(udev_socket, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on));<br> udev_channel = g_io_channel_unix_new (udev_socket);<br> g_io_add_watch (udev_channel, G_IO_IN, hald_udev_data, NULL);<br>
g_io_channel_unref (udev_channel);<br><br>}<br><br>int main()<br>{<br> pid_t child_pid;<br> GMainLoop *loop=g_main_loop_new(NULL,FALSE);<br> child_pid=fork();<br> if(child_pid<0){<br>
printf("\Fork error..");<br> return 0;<br> }<br> else if (child_pid>0){//parent<br> exit(0);<br> }<br> setsid();<br> umask(0);<br>
chdir("/");<br> printf("\nProcess demonized");<br> /*process demonized*/<br><br> osspec_init();<br> g_main_loop_run(loop);<br>}<br> 132,1 Bot
<br><br><br><br><br><br>thank u in advance..<br clear="all"><br>-- <br>Regards<br> ARviND AyyangaR<br><br>