mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: guest01 <guest01@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: OT: calling kernel syscall manually
Date: Tue, 12 Sep 2006 14:05:41 +0200	[thread overview]
Message-ID: <4506A295.6010206@gmail.com> (raw)

Hi

Sorry guys, this question is a little bit off topic, but maybe someone
has an answer, I am sure that there is a simple one. :-)

Ok, I have to find 3 possibilities to create a directory with 3 small c
programs:
1 -> using libc: mkdir(dir,mode)
2 -> using libcsyscall:  syscall(__NR_mkdir, "mkdirLibcSyscall", 0777);
3 -> using kernel directly

Ok, the third one is a little bit tricky, at least for me. I found an
example for lseek, but I don't know how to convert that for mkdir. I
don't know the necessary arguments, ..

> #include <linux/unistd.h>
> 
> _syscall5(int, _llseek, unsigned int, fd,
>           unsigned long, offset_high, unsigned long, offset_low,
>           long long *, result, unsigned int, origin)
> 
> long long
> my_llseek(unsigned int fd, unsigned long long offset, unsigned int origin) {
>           long long result;
>           int retval;
> 
>           retval = _llseek (fd, offset >> 32, offset & 0xffffffff,
>                             &result, origin);
>           return (retval == -1) ? -1 : result;
> }

Any help would be much appreciated. Thxs

regards
peda

             reply	other threads:[~2006-09-12 12:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-12 12:05 guest01 [this message]
2006-09-12 13:34 ` David Woodhouse
2006-09-12 14:31   ` guest01
2006-09-12 14:37     ` David Woodhouse
2006-09-12 20:25   ` Phillip Susi
2006-09-12 20:46     ` Miguel Ojeda
2006-09-12 22:03     ` Arnd Bergmann
2006-09-12 22:43     ` David Woodhouse
2006-09-13 16:52       ` guest01
2006-09-13 17:52         ` David Woodhouse
2006-09-13  5:35 Albert Cahalan
2006-09-13  6:55 ` David Woodhouse
2006-09-13 15:52   ` Albert Cahalan

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=4506A295.6010206@gmail.com \
    --to=guest01@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®