Re: OT: calling kernel syscall manually

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tuesday 12 September 2006 22:25, Phillip Susi wrote:
> 
> What do you mean you have removed the ability to make system calls 
> directly?  That makes no sense.  Glibc has to be able to make system 
> calls so you can write your own code that does the same thing if you want.

the header file <asm/unistd.h> that used to provide the necessary _syscallX()
macros doesn't do that any more. You can still use your own copy of the
macros though, like every libc does internally.

> For the OP: you might want to study the glibc sources to see how it 
> implements syscall, and mimic that.  IIRC it involves making an int 80 
> call on i386.
> 

char *pathname = "/tmp/dir";
int mode = 0644;
int result;
__asm__ volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx"
	: "=a" (result) 
	: "0" (__NR_mkdir),"ri" (pathname),"c" (mode)
	: "memory");

Understanding that inline assembly in detail is beyond what most people
do at university, but interesting nonetheless.

	Arnd <><
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux