hi, > Hello, > > Is it possible somehow to create a TCP socket from kernel and to send > a message when you are in interrupt context ? > When working NOT in interrupt context,it works OK; I called : > kernel_sendmsg(sock, &msg, &iov, 1, length); > and a TCP packet WAS sent (I verified it with a sniffer) > > BUT, in interrupt context, I called : > kernel_sendmsg(sock, &msg, &iov, 1, length); > > I got: > Feb 22 12:02:54 markhost kernel: BUG: sleeping function called from > invalid context > Feb 22 12:02:54 markhost: in_atomic():1, irqs_disabled():0 > > Why is it so ? is there another way create a kernel TCP socket > and to send a packet? you cannot call a function that might sleep from interrupt context (and kernel_sendmsg does it) a general recommendation: code executed in interrupt context must be as fast as it could be. you can use workqueues, adding a work from interrupt context that will execute later in process context. hope this helps, topi > Regards, > Mark > > -- > To unsubscribe from this list: send an email with > "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx > Please read the FAQ at http://kernelnewbies.org/FAQ > -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ