public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] a question about removing file function in eCos programming
       [not found] <1121783251.1835.ezmlm@ecos.sourceware.org>
@ 2005-07-19 14:46 ` Indra Antonius Simalango
  2005-07-19 15:16   ` Andrew Lunn
  2005-07-27  4:55   ` [ECOS] a question about fcntl() in ecos posix programming Indra Antonius Simalango
  0 siblings, 2 replies; 6+ messages in thread
From: Indra Antonius Simalango @ 2005-07-19 14:46 UTC (permalink / raw)
  To: ecos-discuss


deal all,

Below are my quote snippet. It terminate previous page if page number 
is non-zero and start next output page if page number is non-negative. If 
page is -1 removes the most recently opened file. Returns 0 if OK, 2 on
errors. 

-----------------------------------------------------------------------
int wrpage ( OFILE *f, int page )
{
  int err=0 ;

  err = nextopage ( f, page ) ;

  if ( ! err && page == -1 ) {
    if ( remove ( f->cfname ) ) {
      err = msg ( "ES2can't delete file %s:", f->cfname ) ; 
    } else {
      msg ( "Fremoved %s", f->cfname ) ; 
    }
  }
  return err ;
}
-----------------------------------------------------------------------

I've successfully compiled and linked it in linux, but I've found error 
while linking it in eCos v2.0 with this error message :

	file.o : In function 'wrpage' :
	file.o(.text+0x69a):undefined reference to 'remove'

Is 'remove' function really undefined in eCos?

-- 
	regards, 	

	IndrA on 21:31, Jul 19

	http://ic.ee.itb.ac.id/~antonius	


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ECOS] a question about removing file function in eCos programming
  2005-07-19 14:46 ` [ECOS] a question about removing file function in eCos programming Indra Antonius Simalango
@ 2005-07-19 15:16   ` Andrew Lunn
  2005-07-19 15:38     ` Indra Antonius Simalango
  2005-07-27  4:55   ` [ECOS] a question about fcntl() in ecos posix programming Indra Antonius Simalango
  1 sibling, 1 reply; 6+ messages in thread
From: Andrew Lunn @ 2005-07-19 15:16 UTC (permalink / raw)
  To: Indra Antonius Simalango; +Cc: ecos-discuss

> I've successfully compiled and linked it in linux, but I've found error 
> while linking it in eCos v2.0 with this error message :
> 
> 	file.o : In function 'wrpage' :
> 	file.o(.text+0x69a):undefined reference to 'remove'
> 
> Is 'remove' function really undefined in eCos?

Yes, use unlink() instead, or rmdir() is you are trying to delete a
directory. remove is just a wrapper around these two functions.

        Andrew

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ECOS] a question about removing file function in eCos programming
  2005-07-19 15:16   ` Andrew Lunn
@ 2005-07-19 15:38     ` Indra Antonius Simalango
  2005-07-19 18:17       ` Andrew Lunn
  0 siblings, 1 reply; 6+ messages in thread
From: Indra Antonius Simalango @ 2005-07-19 15:38 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: ecos-discuss

On Tue, 19 Jul 2005, Andrew Lunn wrote:

> Yes, use unlink() instead, or rmdir() is you are trying to delete a
> directory. remove is just a wrapper around these two functions.

Thank you, Mr Lunn, it works. ^_^

But I still find some functions in my codes that didn't work in eCos while 
compiling and linking, such as "execl" and "chmod". Is there any 
references that explaining any equivalent functions from linux to eCos? 

-- 
	regards, 	

	IndrA on 22:32, Jul 19

	http://ic.ee.itb.ac.id/~antonius	


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ECOS] a question about removing file function in eCos programming
  2005-07-19 15:38     ` Indra Antonius Simalango
@ 2005-07-19 18:17       ` Andrew Lunn
  2005-07-19 18:38         ` Indra Antonius Simalango
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Lunn @ 2005-07-19 18:17 UTC (permalink / raw)
  To: Indra Antonius Simalango; +Cc: ecos-discuss

> But I still find some functions in my codes that didn't work in eCos while 
> compiling and linking, such as "execl" and "chmod". Is there any 
> references that explaining any equivalent functions from linux to eCos? 

You should remember that eCos is not Linux. Things are not supposed to
be the same.

excel() - cyg_thread_create()
chmod() - cyg_fs_set_attrib() but not all filesystems implement it underneath.

        Andrew

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ECOS] a question about removing file function in eCos programming
  2005-07-19 18:17       ` Andrew Lunn
@ 2005-07-19 18:38         ` Indra Antonius Simalango
  0 siblings, 0 replies; 6+ messages in thread
From: Indra Antonius Simalango @ 2005-07-19 18:38 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: ecos-discuss


Thank you for reminding me , Mr Lunn. Looks like I have to read my 
"Embedded Software Development with eCos" again and again... ^_^

On Tue, 19 Jul 2005, Andrew Lunn wrote:

> You should remember that eCos is not Linux. Things are not supposed to
> be the same.
> 
> excel() - cyg_thread_create()
> chmod() - cyg_fs_set_attrib() but not all filesystems implement it underneath.
> 
>         Andrew
 
 

-- 
	regards, 	

	IndrA on 01:36, Jul 20

	http://ic.ee.itb.ac.id/~antonius	


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ECOS] a question about fcntl() in ecos posix programming
  2005-07-19 14:46 ` [ECOS] a question about removing file function in eCos programming Indra Antonius Simalango
  2005-07-19 15:16   ` Andrew Lunn
@ 2005-07-27  4:55   ` Indra Antonius Simalango
  1 sibling, 0 replies; 6+ messages in thread
From: Indra Antonius Simalango @ 2005-07-27  4:55 UTC (permalink / raw)
  To: ecos-discuss


Dear all,

Below are my quote snippet. It open a serial fax device as a File.
It returns 0 if OK, 1 if busy, 2 on error

-----------------------------------------------------------------------
int ttyopen ( TFILE *f, char *fname, int reverse, int hwfc )
{
  int flags, err=0 ;

  tinit ( f, open ( fname, O_RDWR | O_NOCTTY | O_NONBLOCK), reverse, hwfc 
) ;

  if ( f->fd < 0 ) {
    if ( errno == EBUSY ) {
      err = 1 ; 
    } else {
      err = msg ( "ES2can't open serial port %s:", fname ) ;
    }
  }

  if ( ! err ) {
    if ( ( flags = fcntl( f->fd, F_GETFL, 0 ) ) < 0 ||
	fcntl( f->fd, F_SETFL, ( flags & ~O_NONBLOCK ) ) < 0 )
      err = msg ( "ES2fax device fcntl failed %s:", fname ) ;
  }
...

-----------------------------------------------------------------------

It's successfully compiled and linked, but given an error message while 
running :

	Error : fax device fcntl failed /dev/ser1 : Not supported
 
I've read http://ecos.sourceware.org/docs-latest/ref/posix-input-and-output.html 
saying : Only the F_DUPFD command of fcntl() is currently implemented.

Is there any alternative way to do fcntl to set another flags , as mentioned 
in fcntl.h :

	/* File status flags used for open() and fcntl() */	
	#define O_APPEND     (1<<7)    /* Set append mode */
	#define O_DSYNC      (1<<8)    /* Synchronized I/O data integrity writes */
	#define O_NONBLOCK   (1<<9)    /* No delay */
	#define O_RSYNC      (1<<10)   /* Synchronized read I/O */
	#define O_SYNC       (1<<11)   /* Synchronized I/O file integrity writes */

Any suggestions are welcome.
Thank you.
-- 
	regards, 	

	IndrA on 11:47, Jul 27

	http://ic.ee.itb.ac.id/~antonius	


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-07-27  4:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1121783251.1835.ezmlm@ecos.sourceware.org>
2005-07-19 14:46 ` [ECOS] a question about removing file function in eCos programming Indra Antonius Simalango
2005-07-19 15:16   ` Andrew Lunn
2005-07-19 15:38     ` Indra Antonius Simalango
2005-07-19 18:17       ` Andrew Lunn
2005-07-19 18:38         ` Indra Antonius Simalango
2005-07-27  4:55   ` [ECOS] a question about fcntl() in ecos posix programming Indra Antonius Simalango

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).