public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Indra Antonius Simalango <indra@vlsi.itb.ac.id>
To: <ecos-discuss@ecos.sourceware.org>
Subject: [ECOS] a question about fcntl() in ecos posix programming
Date: Wed, 27 Jul 2005 04:55:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.33.0507271147490.11373-100000@ic.vlsi.itb.ac.id> (raw)
In-Reply-To: <Pine.LNX.4.33.0507192131360.23508-100000@ic.vlsi.itb.ac.id>


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

      parent reply	other threads:[~2005-07-27  4:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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   ` Indra Antonius Simalango [this message]

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=Pine.LNX.4.33.0507271147490.11373-100000@ic.vlsi.itb.ac.id \
    --to=indra@vlsi.itb.ac.id \
    --cc=ecos-discuss@ecos.sourceware.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).