Re: Some questions about kernel programming

2001-07-13 Thread Sergey Babkin
Alfred Perlstein wrote: > > * Greg Lehey <[EMAIL PROTECTED]> [010712 21:08] wrote: > > On Thursday, 12 July 2001 at 6:58:09 -0500, [EMAIL PROTECTED] wrote: > > > Dear Friends > > > > > > I have some questions about kernel programming: > >

Re: Some questions about kernel programming

2001-07-13 Thread Terry Lambert
Alfred Perlstein wrote: > > write() doesn't exist in the kernel. The simple answer is "you're > > going to have to read what the send() syscall does and emulate it". > > First, though, you need to answer the question "why do I want to do > > this in the kernel?" > > it actually exists, however t

Re: Some questions about kernel programming

2001-07-13 Thread Alfred Perlstein
* Eugene L. Vorokov <[EMAIL PROTECTED]> [010713 10:24] wrote: > > ch = fubyte(uaddr); > > And one more question, does this mean that I can't use things x = *uaddr > and *uaddr = x for userspace, but always have to use fubyte() and subyte () ? > If so, what is the reason it was done li

Re: Some questions about kernel programming

2001-07-13 Thread Alfred Perlstein
* Eugene L. Vorokov <[EMAIL PROTECTED]> [010713 10:16] wrote: > > /* > > * return number of characters in a userland address string > > * or -1 if an illegal access occurs. > > */ > Then I don't get it. Won't this piece of code cycle forever fetching > first byte of the string again and again

Re: Some questions about kernel programming

2001-07-13 Thread Drew Eckhardt
In message <[EMAIL PROTECTED]>, [EMAIL PROTECTED] w rites: >> ch = fubyte(uaddr); > >And one more question, does this mean that I can't use things x = *uaddr >and *uaddr = x for userspace, but always have to use fubyte() and subyte () ? Right. >If so, what is the reason it was done

Re: Some questions about kernel programming

2001-07-13 Thread Eugene L. Vorokov
> ch = fubyte(uaddr); And one more question, does this mean that I can't use things x = *uaddr and *uaddr = x for userspace, but always have to use fubyte() and subyte () ? If so, what is the reason it was done like that ? Regards, Eugene To Unsubscribe: send mail to [EMAIL PROTE

Re: Some questions about kernel programming

2001-07-13 Thread Eugene L. Vorokov
> /* > * return number of characters in a userland address string > * or -1 if an illegal access occurs. > */ > int > user_strlen(uaddr) > char *uaddr; > { > int ret; > > ret = -1; > do { > ch = fubyte(uaddr); > ret++; > } while (ch !=

Re: Some questions about kernel programming

2001-07-13 Thread Brian Somers
> Have a look at the digi driver in -current where I did this. The > caveat is that the kernel code looks ugly. From the driver's ioctl > routine: > > case DIGIIO_IDENT: > return (copyout(sc->name, *(char **)data, > strlen(sc

Re: Some questions about kernel programming

2001-07-13 Thread Brian Somers
> > write() doesn't exist in the kernel. The simple answer is "you're > > going to have to read what the send() syscall does and emulate it". > > First, though, you need to answer the question "why do I want to do > > this in the kernel?" > > it actually exists, however the problem is that copyi

Re: Some questions about kernel programming

2001-07-12 Thread Alfred Perlstein
* Eugene L. Vorokov <[EMAIL PROTECTED]> [010713 01:33] wrote: > Forgot to Cc: here: > > > You can't call kernel strlen on a userland address, you must do > > something like this: > > How so ? It seems to work for me. For instance, I used userland > address space buffer to simulate __getcwd() sys

Re: Some questions about kernel programming

2001-07-12 Thread Eugene L. Vorokov
Forgot to Cc: here: > You can't call kernel strlen on a userland address, you must do > something like this: How so ? It seems to work for me. For instance, I used userland address space buffer to simulate __getcwd() syscall on the current process (I was hacking open() syscall and log full path

Re: Some questions about kernel programming

2001-07-12 Thread Alfred Perlstein
* Greg Lehey <[EMAIL PROTECTED]> [010712 21:08] wrote: > On Thursday, 12 July 2001 at 6:58:09 -0500, [EMAIL PROTECTED] wrote: > > Dear Friends > > > > I have some questions about kernel programming: > > You'd be better off sending mail like this to -hacke

Re: Some questions about kernel programming

2001-07-12 Thread Greg Lehey
On Thursday, 12 July 2001 at 6:58:09 -0500, [EMAIL PROTECTED] wrote: > Dear Friends > > I have some questions about kernel programming: You'd be better off sending mail like this to -hackers. I've followed up there. > 1. Why I can call some system calls functio