diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-04-18 15:57:45 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-04-18 15:57:45 +0000 |
commit | 6a14fe48c61536241f4071b75df0bf8773c72e42 (patch) | |
tree | ff8946012e6aaf12b9d61e1a43fde58fdbb100df /nuttx/include | |
parent | a5d2dde9a837218f211a3a7210e247474bfa3680 (diff) | |
download | px4-nuttx-6a14fe48c61536241f4071b75df0bf8773c72e42.tar.gz px4-nuttx-6a14fe48c61536241f4071b75df0bf8773c72e42.tar.bz2 px4-nuttx-6a14fe48c61536241f4071b75df0bf8773c72e42.zip |
Disable line buffering if the file is opened in binary mode; Also fix a couple of fopen/fdopen bugs
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4630 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/include')
-rw-r--r-- | nuttx/include/fcntl.h | 49 | ||||
-rw-r--r-- | nuttx/include/nuttx/fs/fs.h | 2 | ||||
-rw-r--r-- | nuttx/include/sys/stat.h | 11 |
3 files changed, 35 insertions, 27 deletions
diff --git a/nuttx/include/fcntl.h b/nuttx/include/fcntl.h index b6440d085..1af4c3372 100644 --- a/nuttx/include/fcntl.h +++ b/nuttx/include/fcntl.h @@ -1,8 +1,8 @@ /******************************************************************************** * include/fcntl.h * - * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <spudmonkey@racsa.co.cr> + * Copyright (C) 2007-2009, 2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -51,24 +51,33 @@ /* open flag settings for open() (and related APIs) */ -#define O_RDONLY 0x01 /* Open for read access */ -#define O_WRONLY 0x02 /* Open for write access */ -#define O_RDWR 0x03 /* Open for both read & write access */ -#define O_CREAT 0x04 /* Create file/sem/mq object */ -#define O_EXCL 0x08 /* Name must not exist when opened */ -#define O_APPEND 0x10 /* Keep contents, append to end */ -#define O_TRUNC 0x20 /* Delete contents */ -#define O_NONBLOCK 0x40 /* Don't wait for data */ -#define O_NDELAY O_NONBLOCK -#define O_SYNC 0x80 /* Synchronize output on write */ -#define O_DSYNC O_SYNC - -#define O_RSYNC 0x00 /* Sychronize input on read */ -#define O_ACCMODE 0x00 /* Required by POSIX */ -#define O_NOCTTY 0x00 /* Reqired by POSIX */ - -#define O_RDOK O_RDONLY /* Not POSIX */ -#define O_WROK O_WRONLY /* Not POSIX */ +#define O_RDONLY (1 << 0) /* Open for read access (only) */ +#define O_RDOK O_RDONLY /* Read access is permitted (non-standard) */ +#define O_WRONLY (1 << 1) /* Open for write access (only) */ +#define O_WROK O_WRONLY /* Write access is permitted (non-standard) */ +#define O_RDWR (O_RDOK|O_WROK) /* Open for both read & write access */ +#define O_CREAT (1 << 2) /* Create file/sem/mq object */ +#define O_EXCL (1 << 3) /* Name must not exist when opened */ +#define O_APPEND (1 << 4) /* Keep contents, append to end */ +#define O_TRUNC (1 << 5) /* Delete contents */ +#define O_NONBLOCK (1 << 6) /* Don't wait for data */ +#define O_NDELAY O_NONBLOCK /* Synonym for O_NONBLOCK */ +#define O_SYNC (1 << 7) /* Synchronize output on write */ +#define O_DSYNC O_SYNC /* Equivalent to OSYNC in NuttX */ +#define O_BINARY (1 << 8) /* Open the file in binary (untranslated) mode. */ + +/* Unsupported, but required open flags */ + +#define O_RSYNC 0 /* Synchronize input on read */ +#define O_ACCMODE 0 /* Required by POSIX */ +#define O_NOCTTY 0 /* Required by POSIX */ +#defone O_TEXT 0 /* Open the file in text (translated) mode. */ + +/* This is the highest bit number used in the open flags bitset. Bits above + * this bit number may be used within NuttX for other, internal purposes. + */ + +#define _O_MAXBIT 8 /* fcntl() commands */ diff --git a/nuttx/include/nuttx/fs/fs.h b/nuttx/include/nuttx/fs/fs.h index 5b62e69d8..3f111a7b9 100644 --- a/nuttx/include/nuttx/fs/fs.h +++ b/nuttx/include/nuttx/fs/fs.h @@ -270,7 +270,7 @@ struct filelist struct file_struct { int fs_filedes; /* File descriptor associated with stream */ - mode_t fs_oflags; /* Open mode flags */ + uint16_t fs_oflags; /* Open mode flags */ #if CONFIG_NUNGET_CHARS > 0 uint8_t fs_nungotten; /* The number of characters buffered for ungetc */ unsigned char fs_ungotten[CONFIG_NUNGET_CHARS]; diff --git a/nuttx/include/sys/stat.h b/nuttx/include/sys/stat.h index bb166e7e2..5aa827f86 100644 --- a/nuttx/include/sys/stat.h +++ b/nuttx/include/sys/stat.h @@ -1,8 +1,8 @@ /**************************************************************************** * include/sys/stat.h * - * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <spudmonkey@racsa.co.cr> + * Copyright (C) 2007-2009, 2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -47,10 +47,9 @@ * Definitions ****************************************************************************/ -/* mode_t bit settings (most of these do not apply to Nuttx). - * This assumes that the full size of a mode_t is 16-bits. - * (However, mode_t must be size 'int' because it is promoted - * to size int when passed in varargs). +/* mode_t bit settings (most of these do not apply to Nuttx). This assumes + * that the full size of a mode_t is 16-bits. (However, mode_t must be size + * 'int' because it is promoted to size int when passed in varargs). */ #define S_IXOTH 0000001 /* Permissions for others: RWX */ |