mirror of
https://github.com/apache/nuttx.git
synced 2026-10-03 20:27:53 +00:00
O_DIRECTORY, O_NOFOLLOW, O_NOATIME, O_CLOEXEC, __O_SYNC, O_PATH and __O_TMPFILE are defined as shifts by 16 to 22 bits. Where int is 16 bits (AVR, for example), these shifts exceed the width of the type: GCC evaluates them to 0, and the -Wshift-count-overflow warning is not shown because include/ is a system include directory. The oflags argument of open() is an int, so it could not carry those bits anyway. As a result, on arch with int equal 16-bit opendir() opens directories without O_DIRECTORY, so opening a mount point such as /proc fails with ENOENT, and O_CLOEXEC and O_NOFOLLOW have no effect. When UINT_MAX is 0xffff, use the unused bits 2 to 4 for O_DIRECTORY, O_CLOEXEC and O_NOFOLLOW, define O_NOATIME and __O_SYNC as 0 (O_SYNC falls back to O_DSYNC), and leave O_PATH and O_TMPFILE undefined, so that code which needs them fails to build instead of silently opening with the wrong flags; nothing in the tree uses them. _O_MAXBIT becomes 15. On bigger systems (32-bit, 64-bit) keep the original bit shift. Signed-off-by: Alan Carvalho de Assis <acassis@gmail.com> Assisted-by: Claude Opus 5.5 (claude-opus-5-5) |
||
|---|---|---|
| .. | ||
| android | ||
| arpa | ||
| crypto | ||
| cxx | ||
| net | ||
| netinet | ||
| netpacket | ||
| nuttx | ||
| ssp | ||
| sys | ||
| .gitignore | ||
| aio.h | ||
| alloca.h | ||
| assert.h | ||
| byteswap.h | ||
| ctype.h | ||
| debug.h | ||
| dirent.h | ||
| dlfcn.h | ||
| dsp.h | ||
| dspb16.h | ||
| elf.h | ||
| elf32.h | ||
| elf64.h | ||
| endian.h | ||
| err.h | ||
| errno.h | ||
| execinfo.h | ||
| fcntl.h | ||
| fixedmath.h | ||
| fnmatch.h | ||
| ftw.h | ||
| gcov.h | ||
| getopt.h | ||
| glob.h | ||
| grp.h | ||
| hex2bin.h | ||
| iconv.h | ||
| ifaddrs.h | ||
| imx_container.h | ||
| inttypes.h | ||
| iso646.h | ||
| langinfo.h | ||
| libgen.h | ||
| libintl.h | ||
| limits.h | ||
| locale.h | ||
| lzf.h | ||
| malloc.h | ||
| mqueue.h | ||
| netdb.h | ||
| nl_types.h | ||
| nxflat.h | ||
| obstack.h | ||
| paths.h | ||
| poll.h | ||
| pthread.h | ||
| pty.h | ||
| pwd.h | ||
| regex.h | ||
| resolv.h | ||
| sched.h | ||
| search.h | ||
| semaphore.h | ||
| shadow.h | ||
| signal.h | ||
| spawn.h | ||
| stdbool.h | ||
| stddef.h | ||
| stdint.h | ||
| stdio.h | ||
| stdlib.h | ||
| stdnoreturn.h | ||
| string.h | ||
| strings.h | ||
| syscall.h | ||
| syslog.h | ||
| termios.h | ||
| threads.h | ||
| time.h | ||
| ulimit.h | ||
| unistd.h | ||
| utime.h | ||
| uuid.h | ||
| wait.h | ||
| wchar.h | ||
| wctype.h | ||