This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
a question about fcntl() in ecos posix programming
- From: Indra Antonius Simalango <indra at vlsi dot itb dot ac dot id>
- To: <ecos-discuss at ecos dot sourceware dot org>
- Date: Wed, 27 Jul 2005 11:55:19 +0700 (WIT)
- Subject: [ECOS] a question about fcntl() in ecos posix programming
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