mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jan-Benedict Glaw <jbglaw@lug-owl.de>
To: linux-kernel@vger.kernel.org
Cc: sounak chakraborty <sounakrin@yahoo.co.in>
Subject: Re: problem with syscall macro
Date: Wed, 12 Jan 2005 15:57:38 +0100	[thread overview]
Message-ID: <20050112145737.GQ25737@lug-owl.de> (raw)
In-Reply-To: <20050112144047.51119.qmail@web53305.mail.yahoo.com>

[-- Attachment #1: Type: text/plain, Size: 1874 bytes --]

On Wed, 2005-01-12 14:40:47 +0000, sounak chakraborty <sounakrin@yahoo.co.in>
wrote in message <20050112144047.51119.qmail@web53305.mail.yahoo.com>:
>   i am writing a program which willcopy all the lines
> from system log file /var/log/messages and put it in a
> user log file 

That's an easy task.

> i am using syslog with syscall3 but when i am using

Why do you want to use syslog with syscall3? syslogd and klogs will
prepare /var/log/messages for you, so you just need to read() it and
write() it to a different file.

> write system cal it is not able to write anything 
> do i have to add something more 
> i have added the syscall3 macro for write too

No need for that. You shouldn't fiddle directly with your operating
system's syscall interface. You should use libc's wrappers instead,
which will also correctly set errno and all the like.

> do i have to do it for open system call also
> i am little bit confuse with the kernel-user mode
> switching concept too

Actually, you don't need to know anything about Linux' internals, Linux'
syscall interface etc. You only need to know about the
POSIX/SuSv3/whatever interface the libc presents to userspace. If you
directly use system calls, you'll loose portability and need to fight
against stupid problems like this one.

> could you please help me out

The bottom line is that this isn't a kernel-related question, so you'd
probably ask on a C beginner's mailing list...

See:
man 2 open
man 2 close
man 2 read
man 2 write

MfG, JBG

-- 
Jan-Benedict Glaw       jbglaw@lug-owl.de    . +49-172-7608481             _ O _
"Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg  _ _ O
 fuer einen Freien Staat voll Freier Bürger" | im Internet! |   im Irak!   O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2005-01-12 14:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-12 14:40 sounak chakraborty
2005-01-12 14:57 ` Jan-Benedict Glaw [this message]
2005-01-12 15:04 ` linux-os

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=20050112145737.GQ25737@lug-owl.de \
    --to=jbglaw@lug-owl.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sounakrin@yahoo.co.in \
    /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®