9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] stupid kernel question
@ 2010-10-01 19:17 Steve Simon
  2010-10-01 20:24 ` erik quanstrom
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Steve Simon @ 2010-10-01 19:17 UTC (permalink / raw)
  To: 9fans

how does kernel code call plan9 system calls, does it perform a
trap from kernel back into kernel space and make the request just
like a user process or is there a more direct, subtle route?

thanks,

-Steve



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] stupid kernel question
  2010-10-01 19:17 [9fans] stupid kernel question Steve Simon
@ 2010-10-01 20:24 ` erik quanstrom
  2010-10-01 20:25 ` Francisco J Ballesteros
  2010-10-01 22:03 ` Steve Simon
  2 siblings, 0 replies; 4+ messages in thread
From: erik quanstrom @ 2010-10-01 20:24 UTC (permalink / raw)
  To: 9fans

On Fri Oct  1 15:25:16 EDT 2010, steve@quintile.net wrote:
> how does kernel code call plan9 system calls, does it perform a
> trap from kernel back into kernel space and make the request just
> like a user process or is there a more direct, subtle route?

the short answer is that it doesn't.  but read/write/open/close/stat
are done via channels, and often with Blocks.  for example
(hopefully without typos)

	c = namec("/sys/src/9/pc/mkfile", Aopen, OREAD, 0);		/* can call error */
	b = devtab[c->type]->bread(c, 64*1024, 0);
	/* b->wp points to data if successful BLEN(b) is the length */

- erik



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] stupid kernel question
  2010-10-01 19:17 [9fans] stupid kernel question Steve Simon
  2010-10-01 20:24 ` erik quanstrom
@ 2010-10-01 20:25 ` Francisco J Ballesteros
  2010-10-01 22:03 ` Steve Simon
  2 siblings, 0 replies; 4+ messages in thread
From: Francisco J Ballesteros @ 2010-10-01 20:25 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

I'm kind of sleepy. But if I managed to read your mail correctly...

when the kernel wants to do something that can be done with a system
call (mostly read, write, open, ...), it uses the device tab directly, like in

devtab[c->type].write(chan, ....),

using Chan instead of fds in this case.

I mean, I think that almost always you use the internal interface wrapped
by the system call code.

On Fri, Oct 1, 2010 at 9:17 PM, Steve Simon <steve@quintile.net> wrote:
> how does kernel code call plan9 system calls, does it perform a
> trap from kernel back into kernel space and make the request just
> like a user process or is there a more direct, subtle route?
>
> thanks,
>
> -Steve
>
>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] stupid kernel question
  2010-10-01 19:17 [9fans] stupid kernel question Steve Simon
  2010-10-01 20:24 ` erik quanstrom
  2010-10-01 20:25 ` Francisco J Ballesteros
@ 2010-10-01 22:03 ` Steve Simon
  2 siblings, 0 replies; 4+ messages in thread
From: Steve Simon @ 2010-10-01 22:03 UTC (permalink / raw)
  To: 9fans

Thanks to all who replied on-list and off it.

using namec and calling through the device tab looks like what I need,
calling sysopen() with an array of integers seemed just too crufty, I
knew there must be a better way ☺

-Steve



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-10-01 22:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-01 19:17 [9fans] stupid kernel question Steve Simon
2010-10-01 20:24 ` erik quanstrom
2010-10-01 20:25 ` Francisco J Ballesteros
2010-10-01 22:03 ` Steve Simon

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).