You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/06/22 16:25:02 UTC
[GitHub] [incubator-nuttx] xiaoxiang781216 opened a new pull request #1280: Implement fseeko and ftello
xiaoxiang781216 opened a new pull request #1280:
URL: https://github.com/apache/incubator-nuttx/pull/1280
## Summary
And declare chmod/fchmod/utimes
## Impact
## Testing
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #1280: Implement fseeko and ftello
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #1280:
URL: https://github.com/apache/incubator-nuttx/pull/1280#discussion_r445966549
##########
File path: include/stdio.h
##########
@@ -225,6 +216,49 @@ FILE *popen(FAR const char *command, FAR const char *mode);
int pclose(FILE *stream);
#endif
+/* These APIs are not implemented and/or can be synthesized from
+ * supported APIs.
+ */
+
+#ifdef CONFIG_HAVE_INLINE
+static inline int putc(int c, FAR FILE *s)
Review comment:
> i can understand the performance argument for ctype functions.
> but i'm not sure about these FILE* functions. have you measured?
>
I mean the ctype like functions when I mention the performance. If we have to use #ifdef/#endif for ctype function, why we use the different aproach for other functions? I prefer to keep the consistency.
> if you really care the (IMO marginal) performance gain,
> i think the traditional convention is to have a macro version overriding the non-inline function
> so that any app which is not happy with the macro version can do "#undef getc" before using it.
> like:
>
> ```
> int getc(FAR FILE *stream);
> #define getc(s) fgetc(s)
> ```
But I can't use this approach(add #undef ...), because the code is in the 3rd party library, I don't want to change their code if the code totally confirm the standard and the issue come from NuttX side.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #1280: Implement fseeko and ftello
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #1280:
URL: https://github.com/apache/incubator-nuttx/pull/1280#discussion_r443759990
##########
File path: include/sys/time.h
##########
@@ -349,6 +349,40 @@ int getitimer(int which, FAR struct itimerval *value);
int setitimer(int which, FAR const struct itimerval *value,
FAR struct itimerval *ovalue);
+/****************************************************************************
+ * Name: utimes
+ *
+ * Description:
+ * The utimes() function shall set the access and modification times of the
+ * file pointed to by the path argument to the value of the times argument.
+ * utimes() function allows time specifications accurate to the microsecond.
+
+ * For utimes(), the times argument is an array of timeval structures. The
+ * first array member represents the date and time of last access, and the
+ * second member represents the date and time of last modification. The times
+ * in the timeval structure are measured in seconds and microseconds since
+ * the Epoch, although rounding toward the nearest second may occur.
+
+ * If the times argument is a null pointer, the access and modification times
+ * of the file shall be set to the current time. The effective user ID of the
+ * process shall match the owner of the file, has write access to the file or
+ * appropriate privileges to use this call in this manner. Upon completion,
+ * utimes() shall mark the time of the last file status change, st_ctime, for
+ * update.
+ *
+ * Input Parameters:
+ * path - Specifies the file to be modified
+ * times - Specifies the time value to set
+ *
+ * Returned Value:
+ * Upon successful completion, 0 shall be returned. Otherwise, -1 shall be
+ * returned and errno shall be set to indicate the error, and the file
+ * times shall not be affected.
+ *
+ ****************************************************************************/
+
+int utimes(const char *path, const struct timeval times[2]);
Review comment:
> Also from the commit message "but skip the implemenation because VFS layer doesn't support the time/mode change yet:"
> The time change is supported, it's only implemented by a couple of file systems though, FAT and NXFFS I believe.
Could you point me what VFS API can change the file time? I can't find one:(.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #1280: Implement fseeko and ftello
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #1280:
URL: https://github.com/apache/incubator-nuttx/pull/1280#discussion_r443752740
##########
File path: include/sys/time.h
##########
@@ -349,6 +349,40 @@ int getitimer(int which, FAR struct itimerval *value);
int setitimer(int which, FAR const struct itimerval *value,
FAR struct itimerval *ovalue);
+/****************************************************************************
+ * Name: utimes
+ *
+ * Description:
+ * The utimes() function shall set the access and modification times of the
+ * file pointed to by the path argument to the value of the times argument.
+ * utimes() function allows time specifications accurate to the microsecond.
+
+ * For utimes(), the times argument is an array of timeval structures. The
+ * first array member represents the date and time of last access, and the
+ * second member represents the date and time of last modification. The times
+ * in the timeval structure are measured in seconds and microseconds since
+ * the Epoch, although rounding toward the nearest second may occur.
+
+ * If the times argument is a null pointer, the access and modification times
+ * of the file shall be set to the current time. The effective user ID of the
+ * process shall match the owner of the file, has write access to the file or
+ * appropriate privileges to use this call in this manner. Upon completion,
+ * utimes() shall mark the time of the last file status change, st_ctime, for
+ * update.
+ *
+ * Input Parameters:
+ * path - Specifies the file to be modified
+ * times - Specifies the time value to set
+ *
+ * Returned Value:
+ * Upon successful completion, 0 shall be returned. Otherwise, -1 shall be
+ * returned and errno shall be set to indicate the error, and the file
+ * times shall not be affected.
+ *
+ ****************************************************************************/
+
+int utimes(const char *path, const struct timeval times[2]);
Review comment:
utimes require to change the file time not query:
https://pubs.opengroup.org/onlinepubs/009695399/functions/utimes.html
VFS support query but not change yet.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 edited a comment on pull request #1280: Implement fseeko and ftello
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 edited a comment on pull request #1280:
URL: https://github.com/apache/incubator-nuttx/pull/1280#issuecomment-648636305
> what's the point to have prototypes without implementations?
Normally, I will try to implement the function if it isn't to hard like: https://github.com/apache/incubator-nuttx/pull/1279
But, it's hard for utimes/chmod/fchmod since VFS layer lack these concept.
On the other hand, the standard c++ library(e.g. libc++) using all most of c standard functions in header files like this:
```
#include <__config>
#include <stdio.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
using ::FILE;
using ::fpos_t;
using ::size_t;
using ::fclose;
...
```
but don't really use them inside the library. So the declaration but no implementation could avoid the unacceptable change to the 3rd party code.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #1280: Implement fseeko and ftello
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #1280:
URL: https://github.com/apache/incubator-nuttx/pull/1280#discussion_r445952117
##########
File path: include/stdio.h
##########
@@ -225,6 +216,49 @@ FILE *popen(FAR const char *command, FAR const char *mode);
int pclose(FILE *stream);
#endif
+/* These APIs are not implemented and/or can be synthesized from
+ * supported APIs.
+ */
+
+#ifdef CONFIG_HAVE_INLINE
+static inline int putc(int c, FAR FILE *s)
Review comment:
Because some compiler generate the bloat code for inline function:
https://github.com/apache/incubator-nuttx/commit/3b53cd1e578de1e6bddfae605452a77323e5a70b
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 removed a comment on pull request #1280: Implement fseeko and ftello
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 removed a comment on pull request #1280:
URL: https://github.com/apache/incubator-nuttx/pull/1280#issuecomment-650058277
Please ignore the false alarm:
```
/home/xiaoxiang/nuttx/nuttx/include/stdlib.h:149:10: error: Mixed case identifier found
/home/xiaoxiang/nuttx/nuttx/libs/libc/stdlib/lib_Exit.c:31:5: error: Mixed case identifier found
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #1280: Implement fseeko and ftello
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #1280:
URL: https://github.com/apache/incubator-nuttx/pull/1280#discussion_r446045614
##########
File path: include/stdio.h
##########
@@ -225,6 +216,49 @@ FILE *popen(FAR const char *command, FAR const char *mode);
int pclose(FILE *stream);
#endif
+/* These APIs are not implemented and/or can be synthesized from
+ * supported APIs.
+ */
+
+#ifdef CONFIG_HAVE_INLINE
+static inline int putc(int c, FAR FILE *s)
Review comment:
@yamt done, please take a look.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #1280: Implement fseeko and ftello
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #1280:
URL: https://github.com/apache/incubator-nuttx/pull/1280#issuecomment-650672833
@Ouss4 @yamt to speed up the process, I split the PR to the small one, please review again.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] yamt commented on pull request #1280: Implement fseeko and ftello
Posted by GitBox <gi...@apache.org>.
yamt commented on pull request #1280:
URL: https://github.com/apache/incubator-nuttx/pull/1280#issuecomment-648631927
what's the point to have prototypes without implementations?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #1280: Implement fseeko and ftello
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #1280:
URL: https://github.com/apache/incubator-nuttx/pull/1280#discussion_r443752740
##########
File path: include/sys/time.h
##########
@@ -349,6 +349,40 @@ int getitimer(int which, FAR struct itimerval *value);
int setitimer(int which, FAR const struct itimerval *value,
FAR struct itimerval *ovalue);
+/****************************************************************************
+ * Name: utimes
+ *
+ * Description:
+ * The utimes() function shall set the access and modification times of the
+ * file pointed to by the path argument to the value of the times argument.
+ * utimes() function allows time specifications accurate to the microsecond.
+
+ * For utimes(), the times argument is an array of timeval structures. The
+ * first array member represents the date and time of last access, and the
+ * second member represents the date and time of last modification. The times
+ * in the timeval structure are measured in seconds and microseconds since
+ * the Epoch, although rounding toward the nearest second may occur.
+
+ * If the times argument is a null pointer, the access and modification times
+ * of the file shall be set to the current time. The effective user ID of the
+ * process shall match the owner of the file, has write access to the file or
+ * appropriate privileges to use this call in this manner. Upon completion,
+ * utimes() shall mark the time of the last file status change, st_ctime, for
+ * update.
+ *
+ * Input Parameters:
+ * path - Specifies the file to be modified
+ * times - Specifies the time value to set
+ *
+ * Returned Value:
+ * Upon successful completion, 0 shall be returned. Otherwise, -1 shall be
+ * returned and errno shall be set to indicate the error, and the file
+ * times shall not be affected.
+ *
+ ****************************************************************************/
+
+int utimes(const char *path, const struct timeval times[2]);
Review comment:
utimes require to change the file time not query:
https://pubs.opengroup.org/onlinepubs/009695399/functions/utimes.html
VFS support query but not change yet.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] yamt commented on a change in pull request #1280: Implement fseeko and ftello
Posted by GitBox <gi...@apache.org>.
yamt commented on a change in pull request #1280:
URL: https://github.com/apache/incubator-nuttx/pull/1280#discussion_r445954383
##########
File path: include/stdio.h
##########
@@ -225,6 +216,49 @@ FILE *popen(FAR const char *command, FAR const char *mode);
int pclose(FILE *stream);
#endif
+/* These APIs are not implemented and/or can be synthesized from
+ * supported APIs.
+ */
+
+#ifdef CONFIG_HAVE_INLINE
+static inline int putc(int c, FAR FILE *s)
Review comment:
i'm suggesting to make them non-inline functions in *.c.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 edited a comment on pull request #1280: Implement fseeko and ftello
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 edited a comment on pull request #1280:
URL: https://github.com/apache/incubator-nuttx/pull/1280#issuecomment-648636305
> what's the point to have prototypes without implementations?
Normally, I will try to implement the function if it isn't to hard like: https://github.com/apache/incubator-nuttx/pull/1279
But, it's hard for utimes/chmod/fchmod since VFS layer lack these concept.
On the other hand, the standard c++ library(e.g. libc++) using all most of c standard functions in header files like this:
```
#include <__config>
#include <stdio.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
using ::FILE;
using ::fpos_t;
using ::size_t;
using ::fclose;
...
```
but don't really use them inside the library. So the declaration but no implementation could avoid to make the unacceptable change to the 3rd party code.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #1280: Implement fseeko and ftello
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #1280:
URL: https://github.com/apache/incubator-nuttx/pull/1280#issuecomment-650058277
Please ignore the false alarm:
```
/home/xiaoxiang/nuttx/nuttx/include/stdlib.h:149:10: error: Mixed case identifier found
/home/xiaoxiang/nuttx/nuttx/libs/libc/stdlib/lib_Exit.c:31:5: error: Mixed case identifier found
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #1280: Implement fseeko and ftello
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #1280:
URL: https://github.com/apache/incubator-nuttx/pull/1280#issuecomment-650952843
Yes, off_t define to int is strange, the better type is long.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] yamt merged pull request #1280: Implement fseeko and ftello
Posted by GitBox <gi...@apache.org>.
yamt merged pull request #1280:
URL: https://github.com/apache/incubator-nuttx/pull/1280
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] Ouss4 commented on a change in pull request #1280: Implement fseeko and ftello
Posted by GitBox <gi...@apache.org>.
Ouss4 commented on a change in pull request #1280:
URL: https://github.com/apache/incubator-nuttx/pull/1280#discussion_r444075290
##########
File path: include/sys/time.h
##########
@@ -349,6 +349,40 @@ int getitimer(int which, FAR struct itimerval *value);
int setitimer(int which, FAR const struct itimerval *value,
FAR struct itimerval *ovalue);
+/****************************************************************************
+ * Name: utimes
+ *
+ * Description:
+ * The utimes() function shall set the access and modification times of the
+ * file pointed to by the path argument to the value of the times argument.
+ * utimes() function allows time specifications accurate to the microsecond.
+
+ * For utimes(), the times argument is an array of timeval structures. The
+ * first array member represents the date and time of last access, and the
+ * second member represents the date and time of last modification. The times
+ * in the timeval structure are measured in seconds and microseconds since
+ * the Epoch, although rounding toward the nearest second may occur.
+
+ * If the times argument is a null pointer, the access and modification times
+ * of the file shall be set to the current time. The effective user ID of the
+ * process shall match the owner of the file, has write access to the file or
+ * appropriate privileges to use this call in this manner. Upon completion,
+ * utimes() shall mark the time of the last file status change, st_ctime, for
+ * update.
+ *
+ * Input Parameters:
+ * path - Specifies the file to be modified
+ * times - Specifies the time value to set
+ *
+ * Returned Value:
+ * Upon successful completion, 0 shall be returned. Otherwise, -1 shall be
+ * returned and errno shall be set to indicate the error, and the file
+ * times shall not be affected.
+ *
+ ****************************************************************************/
+
+int utimes(const char *path, const struct timeval times[2]);
Review comment:
@xiaoxiang781216 Could you add the suggested `FAR` so we can merge this one?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] yamt commented on a change in pull request #1280: Implement fseeko and ftello
Posted by GitBox <gi...@apache.org>.
yamt commented on a change in pull request #1280:
URL: https://github.com/apache/incubator-nuttx/pull/1280#discussion_r445968651
##########
File path: include/stdio.h
##########
@@ -225,6 +216,49 @@ FILE *popen(FAR const char *command, FAR const char *mode);
int pclose(FILE *stream);
#endif
+/* These APIs are not implemented and/or can be synthesized from
+ * supported APIs.
+ */
+
+#ifdef CONFIG_HAVE_INLINE
+static inline int putc(int c, FAR FILE *s)
Review comment:
i prefer to have less #ifdef CONFIG_xxx.
my suggestion (not to use inline or macro) is consistent with the other functions.
inlined things are minority.
i can argue the 3rd part library is not totally standard-conforming as standards allow these functions to be implemented as macros.
they even suggest the #undef tricks. see APPLICATION USAGE in
https://pubs.opengroup.org/onlinepubs/9699919799/functions/getc.html
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #1280: Implement fseeko and ftello
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #1280:
URL: https://github.com/apache/incubator-nuttx/pull/1280#issuecomment-648636305
> what's the point to have prototypes without implementations?
Normally, I will try to implement the function if it isn't to hard like: https://github.com/apache/incubator-nuttx/pull/1279
But, it's hard for utimes/chmod/fchmod since VFS layer lack these concept.
On the other hand, the standard c++ library(e.g. libc++) using all most of c standard functions in header files like this:
```
#include <__config>
#include <stdio.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
using ::FILE;
using ::fpos_t;
using ::size_t;
using ::fclose;
```
but don't really use them inside the library.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] yamt commented on a change in pull request #1280: Implement fseeko and ftello
Posted by GitBox <gi...@apache.org>.
yamt commented on a change in pull request #1280:
URL: https://github.com/apache/incubator-nuttx/pull/1280#discussion_r445941799
##########
File path: include/stdio.h
##########
@@ -225,6 +216,49 @@ FILE *popen(FAR const char *command, FAR const char *mode);
int pclose(FILE *stream);
#endif
+/* These APIs are not implemented and/or can be synthesized from
+ * supported APIs.
+ */
+
+#ifdef CONFIG_HAVE_INLINE
+static inline int putc(int c, FAR FILE *s)
Review comment:
why don't you make them real (non-inline) functions unconditionally?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 edited a comment on pull request #1280: Implement fseeko and ftello
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 edited a comment on pull request #1280:
URL: https://github.com/apache/incubator-nuttx/pull/1280#issuecomment-650952843
Yes, off_t define to int is strange, the better type is long at least.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #1280: Implement fseeko and ftello
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #1280:
URL: https://github.com/apache/incubator-nuttx/pull/1280#discussion_r445958258
##########
File path: include/stdio.h
##########
@@ -225,6 +216,49 @@ FILE *popen(FAR const char *command, FAR const char *mode);
int pclose(FILE *stream);
#endif
+/* These APIs are not implemented and/or can be synthesized from
+ * supported APIs.
+ */
+
+#ifdef CONFIG_HAVE_INLINE
+static inline int putc(int c, FAR FILE *s)
Review comment:
But these functions are very simple, non-inline increase the code size and decrease the performance. And the same usage spread many place.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] Ouss4 commented on a change in pull request #1280: Implement fseeko and ftello
Posted by GitBox <gi...@apache.org>.
Ouss4 commented on a change in pull request #1280:
URL: https://github.com/apache/incubator-nuttx/pull/1280#discussion_r443766553
##########
File path: include/sys/time.h
##########
@@ -349,6 +349,40 @@ int getitimer(int which, FAR struct itimerval *value);
int setitimer(int which, FAR const struct itimerval *value,
FAR struct itimerval *ovalue);
+/****************************************************************************
+ * Name: utimes
+ *
+ * Description:
+ * The utimes() function shall set the access and modification times of the
+ * file pointed to by the path argument to the value of the times argument.
+ * utimes() function allows time specifications accurate to the microsecond.
+
+ * For utimes(), the times argument is an array of timeval structures. The
+ * first array member represents the date and time of last access, and the
+ * second member represents the date and time of last modification. The times
+ * in the timeval structure are measured in seconds and microseconds since
+ * the Epoch, although rounding toward the nearest second may occur.
+
+ * If the times argument is a null pointer, the access and modification times
+ * of the file shall be set to the current time. The effective user ID of the
+ * process shall match the owner of the file, has write access to the file or
+ * appropriate privileges to use this call in this manner. Upon completion,
+ * utimes() shall mark the time of the last file status change, st_ctime, for
+ * update.
+ *
+ * Input Parameters:
+ * path - Specifies the file to be modified
+ * times - Specifies the time value to set
+ *
+ * Returned Value:
+ * Upon successful completion, 0 shall be returned. Otherwise, -1 shall be
+ * returned and errno shall be set to indicate the error, and the file
+ * times shall not be affected.
+ *
+ ****************************************************************************/
+
+int utimes(const char *path, const struct timeval times[2]);
Review comment:
Sorry there is no VFS API exported. FAT and NXFFS change the stat struct which is then requested by stat() and family.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #1280: Implement fseeko and ftello
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #1280:
URL: https://github.com/apache/incubator-nuttx/pull/1280#discussion_r445971789
##########
File path: include/stdio.h
##########
@@ -225,6 +216,49 @@ FILE *popen(FAR const char *command, FAR const char *mode);
int pclose(FILE *stream);
#endif
+/* These APIs are not implemented and/or can be synthesized from
+ * supported APIs.
+ */
+
+#ifdef CONFIG_HAVE_INLINE
+static inline int putc(int c, FAR FILE *s)
Review comment:
I can change all inline functions with #ifdef CONFIG_HAVE_INLINE to normal function if no other people disagree.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] yamt commented on a change in pull request #1280: Implement fseeko and ftello
Posted by GitBox <gi...@apache.org>.
yamt commented on a change in pull request #1280:
URL: https://github.com/apache/incubator-nuttx/pull/1280#discussion_r445961455
##########
File path: include/stdio.h
##########
@@ -225,6 +216,49 @@ FILE *popen(FAR const char *command, FAR const char *mode);
int pclose(FILE *stream);
#endif
+/* These APIs are not implemented and/or can be synthesized from
+ * supported APIs.
+ */
+
+#ifdef CONFIG_HAVE_INLINE
+static inline int putc(int c, FAR FILE *s)
Review comment:
i can understand the performance argument for ctype functions.
but i'm not sure about these FILE* functions. have you measured?
if you really care the (IMO marginal) performance gain,
i think the traditional convention is to have a macro version overriding the non-inline function
so that any app which is not happy with the macro version can do "#undef getc" before using it.
like:
int getc(FAR FILE *stream);
#define getc(s) fgetc(s)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] Ouss4 commented on a change in pull request #1280: Implement fseeko and ftello
Posted by GitBox <gi...@apache.org>.
Ouss4 commented on a change in pull request #1280:
URL: https://github.com/apache/incubator-nuttx/pull/1280#discussion_r443735285
##########
File path: include/sys/time.h
##########
@@ -349,6 +349,40 @@ int getitimer(int which, FAR struct itimerval *value);
int setitimer(int which, FAR const struct itimerval *value,
FAR struct itimerval *ovalue);
+/****************************************************************************
+ * Name: utimes
+ *
+ * Description:
+ * The utimes() function shall set the access and modification times of the
+ * file pointed to by the path argument to the value of the times argument.
+ * utimes() function allows time specifications accurate to the microsecond.
+
+ * For utimes(), the times argument is an array of timeval structures. The
+ * first array member represents the date and time of last access, and the
+ * second member represents the date and time of last modification. The times
+ * in the timeval structure are measured in seconds and microseconds since
+ * the Epoch, although rounding toward the nearest second may occur.
+
+ * If the times argument is a null pointer, the access and modification times
+ * of the file shall be set to the current time. The effective user ID of the
+ * process shall match the owner of the file, has write access to the file or
+ * appropriate privileges to use this call in this manner. Upon completion,
+ * utimes() shall mark the time of the last file status change, st_ctime, for
+ * update.
+ *
+ * Input Parameters:
+ * path - Specifies the file to be modified
+ * times - Specifies the time value to set
+ *
+ * Returned Value:
+ * Upon successful completion, 0 shall be returned. Otherwise, -1 shall be
+ * returned and errno shall be set to indicate the error, and the file
+ * times shall not be affected.
+ *
+ ****************************************************************************/
+
+int utimes(const char *path, const struct timeval times[2]);
Review comment:
```suggestion
int utimes(FAR const char *path, const struct timeval times[2]);
```
Also from the commit message "but skip the implemenation because VFS layer doesn't support the time/mode change yet:"
The time change is supported, it's only implemented by a couple of file systems though, FAT and NXFFS I believe.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #1280: Implement fseeko and ftello
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #1280:
URL: https://github.com/apache/incubator-nuttx/pull/1280#discussion_r445966549
##########
File path: include/stdio.h
##########
@@ -225,6 +216,49 @@ FILE *popen(FAR const char *command, FAR const char *mode);
int pclose(FILE *stream);
#endif
+/* These APIs are not implemented and/or can be synthesized from
+ * supported APIs.
+ */
+
+#ifdef CONFIG_HAVE_INLINE
+static inline int putc(int c, FAR FILE *s)
Review comment:
> i can understand the performance argument for ctype functions.
> but i'm not sure about these FILE* functions. have you measured?
>
I mean the ctype like functions when I mention the performance. If we have to use #ifdef/#endif for ctype function, why we use the different aproach for other functions? I prefer to keep the consistency.
> if you really care the (IMO marginal) performance gain,
> i think the traditional convention is to have a macro version overriding the non-inline function
> so that any app which is not happy with the macro version can do "#undef getc" before using it.
> like:
>
> ```
> int getc(FAR FILE *stream);
> #define getc(s) fgetc(s)
> ```
But I can't use this approach(add #undef ...), because the code is in the 3rd party library, I don't want to change their code if the code totally confirm the standard.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org