Hi Martin, yes I use fopen() otherwise it can't pass compile :-) . the file are scha_api_rpc.c and scds_fm.c in rgm_president.cc, we can use os:: functions. yet scha_api_rpc.c is c file , and can't use os:: .
In os::, it use "struct _buf *fp;" yet I down't know how to use this *fp. Thanks Edward ----- Original Message ----- From: Martin Rattner To: Edward Cc: ha-clusters-discuss at opensolaris.org Sent: Thursday, January 22, 2009 9:39 AM Subject: Re: [ha-clusters-discuss] Hi all, How to open a file in _kernel state? Edward, The rgmd is userland code. If you are actually modifying rgmd code, the _KERNEL macro will be undefined. Perhaps you could give more details of which source file you are modifying, and what error messages were produced by the compiler. Did you #include <stdio.h> in the file where you attempted this? That is necessary. Also, your example below calls "fileopen" which does not exist. The correct name of the function is "fopen". It is documented in the fopen(3C) man page. On 01/21/09 16:49, Edward wrote: > Hi Andrew and all, > I am trying to debug some code in the RGM,yet ,I don't know how to do it. > so I want to use the log information to record some information. > in some code of RGM,it seems run in the kernel, so i can't use FILE > struction. > > I just want to record some code infomation in the file to better > understand the code. > > > Thanks > Edward > > ----- Original Message ----- > *From:* Andrew Hisgen <mailto:Andrew.Hisgen at Sun.COM> > *To:* yang <mailto:yanggongming at huawei.com> > *Cc:* ha-clusters-discuss at opensolaris.org > <mailto:ha-clusters-discuss at opensolaris.org> > *Sent:* Wednesday, January 21, 2009 11:36 PM > *Subject:* Re: [ha-clusters-discuss] Hi all, How to open a file in > _kernel state? > > Hi Yang, > > Can you clarify what you are trying to do? > Are you trying to open a file for writing from within > the kernel? That is, is the code that you are writing > intended to run in the kernel? > > thanks, > Andy > > yang wrote: > > Hi all, > > when define _KERNEL, I use: > > FILE * fp; > > fp=fileopen("path","w"); > > > > > > and the sun studio compile promp errors. > > > > So in C files , how can I open a fild and write something into it > in _KERNEL stat? > > > > Thanks > > > -- > Email: Andrew.Hisgen at sun.com <mailto:Andrew.Hisgen at sun.com> > > > ------------------------------------------------------------------------ > > _______________________________________________ > ha-clusters-discuss mailing list > ha-clusters-discuss at opensolaris.org > http://mail.opensolaris.org/mailman/listinfo/ha-clusters-discuss -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.opensolaris.org/pipermail/ha-clusters-discuss/attachments/20090122/2087f0de/attachment.html>