public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Jui-Hao Chiang <windtracekimo@gmail.com>
To: bluez-devel@lists.sourceforge.net
Subject: [Bluez-devel] Using multiple process on single SCO socket
Date: Wed, 8 Oct 2008 18:57:34 +0000 (UTC)	[thread overview]
Message-ID: <loom.20081008T184606-189@post.gmane.org> (raw)

Hi,
I am currently simulating a duplex voice traffic on a single SCO link.
(two adapters connect with one single SCO user level socket).
On each side, after connected, I fork another process to perform the write
operations, and the parent process will perform the read operaions.
The pseudo code looks like the following

connect(sockfd);
if (!fork()) { /* child process */
  while (1) {
    if (write(sockfd) < 0) break;
  }
  close(sockfd);
  return 0;
}
/* parent process */
while(1) {
  if (read(sockfd) < 0) break;
}
close(sockfd);


But after one side close the connection, the other side of the PC has this oops.
BUG: unable to handle kernel NULL pointer dereference at virtual address 00000058
Call Trace:
[memcpy_fromiovec+55/96] memcpy_fromiovec+0x37/0x60
[<f8bc6fa9>] sco_sock_sendmsg+0x119/0x160 [sco]
[sock_aio_write+285/304] sock_aio_write+0x11d/0x130
[getnstimeofday+54/208] getnstimeofday+0x36/0xd0
[do_sync_write+213/288] do_sync_write+0xd5/0x120
[hrtimer_try_to_cancel+60/144] hrtimer_try_to_cancel+0x3c/0x90
[autoremove_wake_function+0/80] autoremove_wake_function+0x0/0x50
[hrtimer_wakeup+0/32] hrtimer_wakeup+0x0/0x20
[vfs_write+346/368] vfs_write+0x15a/0x170
[sys_write+65/112] sys_write+0x41/0x70

Is there any safe way to run two processes on a single SCO socket?
Originally I use the following way, but actually these two direction traffic
will block each other.

while(1) {
  if (write(sockfd) < 0) break;
  if (read(sockfd) < 0) break;
}
close(sockfd);


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

                 reply	other threads:[~2008-10-08 18:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=loom.20081008T184606-189@post.gmane.org \
    --to=windtracekimo@gmail.com \
    --cc=bluez-devel@lists.sourceforge.net \
    /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