diff --git a/Documentation/NuttxPortingGuide.html b/Documentation/NuttxPortingGuide.html index 04466e4278b..9e5c8122a9b 100644 --- a/Documentation/NuttxPortingGuide.html +++ b/Documentation/NuttxPortingGuide.html @@ -12,7 +12,7 @@

NuttX RTOS Porting Guide

-

Last Updated: August 13, 2013

+

Last Updated: September 28, 2013

@@ -2806,13 +2806,13 @@ extern void up_ledoff(int led); Each character device driver must implement an instance of struct file_operations. That structure defines a call table with the following methods:

diff --git a/Documentation/NuttxUserGuide.html b/Documentation/NuttxUserGuide.html index 68df699dd24..bedc07226c9 100644 --- a/Documentation/NuttxUserGuide.html +++ b/Documentation/NuttxUserGuide.html @@ -13,7 +13,7 @@

NuttX Operating System

User's Manual

by

Gregory Nutt

-

Last Updated: June 4, 2013

+

Last Updated: September 28, 2013

@@ -250,14 +250,14 @@ paragraphs.

2.1.1 task_create

-Function Prototype: +Function Prototype:

-Description: +Description: This function creates and activates a new task with a specified priority and returns its system-assigned ID.

@@ -291,7 +291,7 @@ int task_create(char *name, int priority, int stack_size, main_t entry, char * c redirection of standard I/O is supported.

-Input Parameters: +Input Parameters:

- Returned Value: + Returned Value:

-Assumptions/Limitations: +Assumptions/Limitations:

POSIX Compatibility: This is a NON-POSIX interface. VxWorks provides the following similar interface: @@ -339,7 +339,7 @@ VxWorks provides the following similar interface:

2.1.2 task_init

-Function Prototype: +Function Prototype:

    #include <sched.h>
    int task_init(struct tcb_s *tcb, char *name, int priority, uint32_t *stack, uint32_t stack_size,
@@ -358,7 +358,7 @@ VxWorks provides the following similar interface:
   This must be done by calling task_activate().
 

-Input Parameters: +Input Parameters:

-Returned Value: +Returned Value:

- Returned Value: + Returned Value: This function does not return on success. - On failure, it will return -1 (ERROR) and will set the errno value appropriately. + On failure, it will return -1 (ERROR) and will set the errno value appropriately.

- Assumptions/Limitations: + Assumptions/Limitations:

POSIX Compatibility: @@ -804,16 +804,16 @@ int execl(FAR const char *path, ...);

  • ...: - A list of the string arguments to be recevied by the program. + A list of the string arguments to be recevied by the program. Zero indicates the end of the list.

    - Returned Value: + Returned Value: This function does not return on success. - On failure, it will return -1 (ERROR) and will set the errno value appropriately. + On failure, it will return -1 (ERROR) and will set the errno value appropriately.

    - Assumptions/Limitations: + Assumptions/Limitations:

    POSIX Compatibility: @@ -924,7 +924,7 @@ int posix_spawnp(FAR pid_t *pid, FAR const char *file,

    - Returned Value: + Returned Value: posix_spawn() and posix_spawnp() will return zero on success. Otherwise, an error number will be returned as the function return value to indicate the error:

    @@ -938,7 +938,7 @@ int posix_spawnp(FAR pid_t *pid, FAR const char *file,

    - Assumptions/Limitations: + Assumptions/Limitations:

    • @@ -1013,7 +1013,7 @@ int posix_spawn_file_actions_destroy(FAR posix_spawn_file_actions_t *file_action

    - Returned Value: + Returned Value: On success, this function returns 0; on failure it will return an error number from <errno.h>

    @@ -1044,7 +1044,7 @@ int posix_spawn_file_actions_addclose(FAR posix_spawn_file_actions_t *file_actio

    - Returned Value: + Returned Value: On success, this function returns 0; on failure it will return an error number from <errno.h>

    @@ -1081,7 +1081,7 @@ int posix_spawn_file_actions_adddup2(FAR posix_spawn_file_actions_t *file_action

    - Returned Value: + Returned Value: On success, this function returns 0; on failure it will return an error number from <errno.h>

    @@ -1126,7 +1126,7 @@ int posix_spawn_file_actions_addopen(FAR posix_spawn_file_actions_t *file_action

    - Returned Value: + Returned Value: On success, this function returns 0; on failure it will return an error number from <errno.h>

    @@ -1162,7 +1162,7 @@ int posix_spawnattr_init(FAR posix_spawnattr_t *attr);

    - Returned Value: + Returned Value: On success, this function returns 0; on failure it will return an error number from <errno.h>

    @@ -1192,7 +1192,7 @@ int posix_spawnattr_getflags(FAR const posix_spawnattr_t *attr, FAR short *flags

    - Returned Value: + Returned Value: On success, this function returns 0; on failure it will return an error number from <errno.h>

    @@ -1222,7 +1222,7 @@ int posix_spawnattr_getschedparam(FAR const posix_spawnattr_t *attr, FAR struct

    - Returned Value: + Returned Value: On success, this function returns 0; on failure it will return an error number from <errno.h>

    @@ -1252,7 +1252,7 @@ int posix_spawnattr_getschedpolicy(FAR const posix_spawnattr_t *attr, FAR int *p

    - Returned Value: + Returned Value: On success, this function returns 0; on failure it will return an error number from <errno.h>

    @@ -1284,7 +1284,7 @@ int posix_spawnattr_getsigmask(FAR const posix_spawnattr_t *attr, FAR sigset_t *

    - Returned Value: + Returned Value: On success, this function returns 0; on failure it will return an error number from <errno.h>

    @@ -1314,7 +1314,7 @@ int posix_spawnattr_setflags(FAR posix_spawnattr_t *attr, short flags);

    - Returned Value: + Returned Value: On success, this function returns 0; on failure it will return an error number from <errno.h>

    @@ -1347,7 +1347,7 @@ int posix_spawnattr_setschedparam(FAR posix_spawnattr_t *attr, FAR const struct Returned Value: On success, this function returns 0; on failure it will return an error number from <errno.h>

    - +

    2.1.24 posix_spawnattr_setschedpolicy

    Function Prototype: @@ -1406,7 +1406,7 @@ int posix_spawnattr_setsigmask(FAR posix_spawnattr_t *attr, FAR const sigset_t *

    - Returned Value: + Returned Value: On success, this function returns 0; on failure it will return an error number from <errno.h>

    @@ -1515,7 +1515,7 @@ int task_spawn(FAR pid_t *pid, FAR const char *name, main_t entry,

    - Returned Value: + Returned Value: task_spawn() will return zero on success. Otherwise, an error number will be returned as the function return value to indicate the error:

    @@ -1550,7 +1550,7 @@ int task_spawnattr_getstacksize(FAR const posix_spawnattr_t *attr, FAR size_t *s

    - Returned Value: + Returned Value: On success, this function returns 0; on failure it will return an error number from <errno.h>

    @@ -1712,7 +1712,7 @@ int posix_spawn_file_actions_init(FAR posix_spawn_file_actions_t *file_actions);

    2.2.2 sched_getparam

    -Function Prototype: +Function Prototype:

         #include <sched.h>
         int sched_getparam (pid_t pid, struct sched_param *param);
    @@ -1722,7 +1722,7 @@ int posix_spawn_file_actions_init(FAR posix_spawn_file_actions_t *file_actions);
     Description: This function gets the scheduling priority
     of the task specified by pid.
     

    -Input Parameters: +Input Parameters:

    • pid. The task ID of the task. @@ -1736,20 +1736,20 @@ of the task specified by pid.

    -Returned Value: +Returned Value:

    • 0 (OK) if successful, otherwise -1 (ERROR).

    -Assumptions/Limitations: +Assumptions/Limitations:

    POSIX Compatibility: Comparable to the POSIX interface of the same name.

    2.2.3 sched_setscheduler

    - Function Prototype: + Function Prototype:

       #include <sched.h>
      @@ -1762,7 +1762,7 @@ int sched_setscheduler (pid_t pid, int policy, const struct sched_param *param);
         The parameter param holds the priority of the thread under the new policy.
       

      - Input Parameters: + Input Parameters:

      • @@ -1781,7 +1781,7 @@ int sched_setscheduler (pid_t pid, int policy, const struct sched_param *param);

      - Returned Value: + Returned Value: On success, sched_setscheduler() returns OK (zero). On error, ERROR (-1) is returned, and errno is set appropriately:

      @@ -1798,7 +1798,7 @@ int sched_setscheduler (pid_t pid, int policy, const struct sched_param *param);

      2.2.4 sched_getscheduler

      -Function Prototype: +Function Prototype:

         #include <sched.h>
         int sched_getscheduler (pid_t pid);
        @@ -1810,7 +1810,7 @@ int sched_getscheduler (pid_t pid);
           pid equals zero, the policy of the calling process will
           be retrieved.
         

        -Input Parameters: +Input Parameters:

        • pid. The task ID of the task to query. @@ -1818,7 +1818,7 @@ int sched_getscheduler (pid_t pid);

        -Returned Value: +Returned Value:

        • On success, sched_getscheduler() returns the policy for @@ -1830,14 +1830,14 @@ int sched_getscheduler (pid_t pid);

        -Assumptions/Limitations: +Assumptions/Limitations:

        POSIX Compatibility: Comparable to the POSIX interface of the same name.

        2.2.5 sched_yield

        -Function Prototype: +Function Prototype:

             #include <sched.h>
             int sched_yield(void);
        @@ -1849,13 +1849,13 @@ up the CPU (only to other tasks at the same priority).
         

        Input Parameters: None.

        -Returned Value: +Returned Value:

        • 0 (OK) or -1 (ERROR)

        -Assumptions/Limitations: +Assumptions/Limitations:

        POSIX Compatibility: Comparable to the POSIX interface of the same name. @@ -1863,7 +1863,7 @@ interface of the same name.

        2.2.6 sched_get_priority_max

        -Function Prototype: +Function Prototype:

             #include <sched.h>
             int sched_get_priority_max (int policy)
        @@ -1873,19 +1873,19 @@ interface of the same name.
         Description: This function returns the value of the highest
         possible task priority for a specified scheduling policy.
         

        -Input Parameters: +Input Parameters:

        • policy. Scheduling policy requested.

        -Returned Value: +Returned Value:

        • The maximum priority value or -1 (ERROR).

        -Assumptions/Limitations: +Assumptions/Limitations:

        POSIX Compatibility: Comparable to the POSIX interface of the same name. @@ -1893,7 +1893,7 @@ interface of the same name.

        2.2.7 sched_get_priority_min

        -Function Prototype: +Function Prototype:

             #include <sched.h>
             int sched_get_priority_min (int policy);
        @@ -1903,19 +1903,19 @@ interface of the same name.
         Description: This function returns the value of the lowest
         possible task priority for a specified scheduling policy.
         

        -Input Parameters: +Input Parameters:

        • policy. Scheduling policy requested.

        -Returned Value: +Returned Value:

        • The minimum priority value or -1 (ERROR)

        -Assumptions/Limitations: +Assumptions/Limitations:

        POSIX Compatibility: Comparable to the POSIX interface of the same name. @@ -1923,14 +1923,14 @@ interface of the same name.

        2.2.8 sched_get_rr_interval

        -Function Prototype: +Function Prototype:

             #include <sched.h>
             int sched_get_rr_interval (pid_t pid, struct timespec *interval);
         

        - Description: + Description: sched_rr_get_interval() writes the timeslice interval for task identified by pid into the timespec structure pointed to by interval. If pid is zero, the timeslice @@ -1939,7 +1939,7 @@ interface of the same name. scheduling policy.'

        - Input Parameters: + Input Parameters:

        • pid. The task ID of the task. If pid is zero, the @@ -1948,7 +1948,7 @@ priority of the calling task is returned.

        - Returned Value: + Returned Value: On success, sched_rr_get_interval() returns OK (0). On error, ERROR (-1) is returned, and errno is set to:

        @@ -1960,7 +1960,7 @@ priority of the calling task is returned.

      - Assumptions/Limitations: + Assumptions/Limitations:

      POSIX Compatibility: Comparable to the POSIX interface of the same name. @@ -2100,7 +2100,7 @@ int ret = sigaction(SIGCHLD, &sa, NULL);

      2.3.1 sched_lock

      -Function Prototype: +Function Prototype:

           #include <sched.h>
           int sched_lock(void);
      @@ -2115,13 +2115,13 @@ number of times) or until it blocks itself.
       

      Input Parameters: None.

      -Returned Value: +Returned Value:

      • OK or ERROR.

      -Assumptions/Limitations: +Assumptions/Limitations:

      POSIX Compatibility: This is a NON-POSIX interface. VxWorks provides the comparable interface: @@ -2132,7 +2132,7 @@ VxWorks provides the comparable interface:

      2.3.2 sched_unlock

      -Function Prototype: +Function Prototype:

           #include <sched.h>
           int sched_unlock(void);
      @@ -2148,13 +2148,13 @@ eligible to preempt the current task will execute.
       

      Input Parameters: None.

      -Returned Value: +Returned Value:

      • OK or ERROR.

      -Assumptions/Limitations: +Assumptions/Limitations:

      POSIX Compatibility: This is a NON-POSIX interface. VxWorks provides the comparable interface: @@ -2165,7 +2165,7 @@ VxWorks provides the comparable interface:

      2.3.3 sched_lockcount

      -Function Prototype: +Function Prototype:

           #include <sched.h>
           int32_t sched_lockcount(void)
      @@ -2179,13 +2179,13 @@ on this thread of execution.
       

      Input Parameters: None.

      -Returned Value: +Returned Value:

      • The current value of the lockCount.

      -Assumptions/Limitations: +Assumptions/Limitations:

      POSIX Compatibility: None.

      @@ -2193,14 +2193,14 @@ on this thread of execution.

      2.3.4 waitpid

      -Function Prototype: +Function Prototype:

           #include <sys/wait.h>
           ipid_t waitpid(pid_t pid, int *stat_loc, int options);
       

      - Description: + Description:

      The following discussion is a general description of the waitpid() interface. @@ -2223,7 +2223,7 @@ on this thread of execution. Because waitpid() is not fully POSIX compliant, it must be specifically enabled by setting CONFIG_SCHED_WAITPID in the NuttX configuration file.

      - Input Parameters: + Input Parameters:

      • pid. The task ID of the thread to waid for
      • @@ -2256,19 +2256,19 @@ on this thread of execution.
        • WCONTINUED. - The waitpid() function will report the status of any continued child process specified by pid whose status has not been reported since it continued from a job control stop. + The waitpid() function will report the status of any continued child process specified by pid whose status has not been reported since it continued from a job control stop.
        • WNOHANG. - The waitpid() function will not suspend execution of the calling thread if status is not immediately available for one of the child processes specified by pid. + The waitpid() function will not suspend execution of the calling thread if status is not immediately available for one of the child processes specified by pid.
        • WUNTRACED. - The status of any child processes specified by pid that are stopped, and whose status has not yet been reported since they stopped, will also be reported to the requesting process. + The status of any child processes specified by pid that are stopped, and whose status has not yet been reported since they stopped, will also be reported to the requesting process.

        - If the calling process has SA_NOCLDWAIT set or has SIGCHLD set to SIG_IGN, and the process has no unwaited-for children that were transformed into zombie processes, the calling thread will block until all of the children of the process containing the calling thread terminate, and waitpid() will fail and set errno to ECHILD. + If the calling process has SA_NOCLDWAIT set or has SIGCHLD set to SIG_IGN, and the process has no unwaited-for children that were transformed into zombie processes, the calling thread will block until all of the children of the process containing the calling thread terminate, and waitpid() will fail and set errno to ECHILD.

        If waitpid() returns because the status of a child process is available, these functions will return a value equal to the process ID of the child process. @@ -2296,23 +2296,23 @@ on this thread of execution.

      • WEXITSTATUS(stat_val). - If the value of WIFEXITED(stat_val) is non-zero, this macro evaluates to the low-order 8 bits of the status argument that the child process passed to _exit() or exit(), or the value the child process returned from main(). + If the value of WIFEXITED(stat_val) is non-zero, this macro evaluates to the low-order 8 bits of the status argument that the child process passed to _exit() or exit(), or the value the child process returned from main().
      • WIFSIGNALED(stat_val). - Evaluates to a non-zero value if status was returned for a child process that terminated due to the receipt of a signal that was not caught (see >signal.h<). + Evaluates to a non-zero value if status was returned for a child process that terminated due to the receipt of a signal that was not caught (see >signal.h<).
      • WTERMSIG(stat_val). - If the value of WIFSIGNALED(stat_val) is non-zero, this macro evaluates to the number of the signal that caused the termination of the child process. + If the value of WIFSIGNALED(stat_val) is non-zero, this macro evaluates to the number of the signal that caused the termination of the child process.
      • WIFSTOPPED(stat_val). - Evaluates to a non-zero value if status was returned for a child process that is currently stopped. + Evaluates to a non-zero value if status was returned for a child process that is currently stopped.
      • WSTOPSIG(stat_val). - If the value of WIFSTOPPED(stat_val) is non-zero, this macro evaluates to the number of the signal that caused the child process to stop. + If the value of WIFSTOPPED(stat_val) is non-zero, this macro evaluates to the number of the signal that caused the child process to stop.
      • WIFCONTINUED(stat_val). @@ -2320,7 +2320,7 @@ on this thread of execution.

      - Returned Value: + Returned Value:

      If waitpid() returns because the status of a child process is available, it will return a value equal to the process ID of the child process for which status is reported. @@ -2337,21 +2337,21 @@ on this thread of execution.

      • ECHILD. - The process specified by pid does not exist or is not a child of the calling process, or the process group specified by pid does not exist or does not have any member process that is a child of the calling process. + The process specified by pid does not exist or is not a child of the calling process, or the process group specified by pid does not exist or does not have any member process that is a child of the calling process.
      • EINTR. The function was interrupted by a signal. - The value of the location pointed to by stat_loc is undefined. + The value of the location pointed to by stat_loc is undefined.
      • EINVAL. - The options argument is not valid. + The options argument is not valid.

      - Assumptions/Limitations: + Assumptions/Limitations:

      POSIX Compatibility: Comparable to the POSIX interface of the same name, but the implementation is incomplete (as detailed above). @@ -2359,7 +2359,7 @@ on this thread of execution.

      2.3.5 waitid

      -Function Prototype: +Function Prototype:

           #include <sys/wait.h>
           #ifdef CONFIG_SCHED_HAVE_PARENT
      @@ -2406,25 +2406,25 @@ on this thread of execution.
       
      • WEXITED: - Wait for processes that have exited. + Wait for processes that have exited.
      • WSTOPPED: - Status will be returned for any child that has stopped upon receipt of a signal. + Status will be returned for any child that has stopped upon receipt of a signal.
      • WCONTINUES: - Status will be returned for any child that was stopped and has been continued. + Status will be returned for any child that was stopped and has been continued.
      • WNOHANG: - Return immediately if there are no children to wait for. + Return immediately if there are no children to wait for.
      • WNOWAIT: Keep the process whose status is returned in info in a waitable state. This will not affect the state of the process; - the process may be waited for again after this call completes. + the process may be waited for again after this call completes.
      The info argument must point to a siginfo_t structure. @@ -2436,9 +2436,9 @@ on this thread of execution. See the description above.

      - Returned Value: + Returned Value: If waitid() returns due to the change of state of one of its children, 0 is returned. - Otherwise, -1 is returned and errno is set to indicate the error. + Otherwise, -1 is returned and errno is set to indicate the error.

      The waitid() function will fail if: @@ -2447,18 +2447,18 @@ on this thread of execution.

    • ECHILD:
    • - The calling process has no existing unwaited-for child processes. + The calling process has no existing unwaited-for child processes.
    • EINTR:
    • - The waitid() function was interrupted by a signal. + The waitid() function was interrupted by a signal.
    • EINVAL: An invalid value was specified for options, or idtype and id specify an invalid set of processes.

    - Assumptions/Limitations: + Assumptions/Limitations:

    POSIX Compatibility: Comparable to the POSIX interface of the same name, but the implementation is incomplete (as detailed in the description above). @@ -2466,7 +2466,7 @@ on this thread of execution.

    2.3.6 wait

    -Function Prototype: +Function Prototype:

         #include <sys/wait.h>
         #ifdef CONFIG_SCHED_HAVE_PARENT
    @@ -2474,7 +2474,7 @@ on this thread of execution.
         #endif
     

    - Description: + Description:

    The following discussion is a general description of the wait() interface. @@ -2492,17 +2492,17 @@ on this thread of execution. Otherwise, its behavior will be modified by the values of the pid and options arguments.

    - Input Parameters: + Input Parameters:

    • stat_loc. The location to return the exit status

    - Returned Value: + Returned Value: See the values returned by waitpaid().

    - Assumptions/Limitations: + Assumptions/Limitations:

    POSIX Compatibility: Comparable to the POSIX interface of the same name, but the implementation is incomplete (as detailed in the description waitpaid()). @@ -2511,13 +2511,13 @@ on this thread of execution.

    2.3.7 atexit

    -Function Prototype: +Function Prototype:

         #include <stdlib.h>
         int atexit(void (*func)(void));
     

    - Description: + Description: Registers a function to be called at program exit. The atexit() function registers the given function to be called at normal process termination, whether via exit() or via return from the program's main().

    @@ -2525,19 +2525,19 @@ on this thread of execution. NOTE: CONFIG_SCHED_ATEXIT must be defined to enable this function.

    - Input Parameters: + Input Parameters:

    • func. A pointer to the function to be called when the task exits.

    - Returned Value: + Returned Value: On success, atexit() returns OK (0). On error, ERROR (-1) is returned, and errno is set to indicate the cause of the failure.

    - Assumptions/Limitations: + Assumptions/Limitations:

    POSIX Compatibility: Comparable to the ISO C interface of the same name. Limitiations in the current implementation: @@ -2550,13 +2550,13 @@ on this thread of execution.

    2.3.8 on_exit

    -Function Prototype: +Function Prototype:

         #include <stdlib.h>
         int on_exit(CODE void (*func)(int, FAR void *), FAR void *arg)
     

    - Description: + Description: Registers a function to be called at program exit. The on_exit() function registers the given function to be called at normal process termination, whether via exit() or via return from the program's main(). The function is passed the status argument given to the last call to exit() and the arg argument from on_exit(). @@ -2565,25 +2565,25 @@ on this thread of execution. NOTE: CONFIG_SCHED_ONEXIT must be defined to enable this function

    - Input Parameters: + Input Parameters:

    • func. A pointer to the function to be called when the task exits.
    • arg. An argument that will be provided to the on_exit() function when the task exits.

    - Returned Value: + Returned Value: On success, on_exit() returns OK (0). On error, ERROR (-1) is returned, and errno is set to indicate the cause of the failure.

    - Assumptions/Limitations: + Assumptions/Limitations:

    POSIX Compatibility: This function comes from SunOS 4, but is also present in libc4, libc5 and glibc. It no longer occurs in Solaris (SunOS 5). - Avoid this function, and use the standard atexit() instead. + Avoid this function, and use the standard atexit() instead.

    1. Only a single on_exit function can be registered unless CONFIG_SCHED_ONEXIT_MAX defines a larger number.
    2. @@ -2619,7 +2619,7 @@ on this thread of execution.

      2.4.1 mq_open

      -Function Prototype: +Function Prototype:

           #include <mqueue.h>
           mqd_t mq_open(const char *mqName, int oflags, ...);
      @@ -2632,7 +2632,7 @@ call of mq_open(), the task can reference the message queue using
       the address returned by the call. The message queue remains usable
       until it is closed by a successful call to mq_close().
       

      -Input Parameters: +Input Parameters:

      • mqName. Name of the queue to open
      • oflags. Open flags. These may be any combination of: @@ -2668,13 +2668,13 @@ message that can be sent or received. Other elements of attr are ignored

      -Returned Value: +Returned Value:

      • A message queue descriptor or -1 (ERROR)

      -Assumptions/Limitations: +Assumptions/Limitations:

      POSIX Compatibility: Comparable to the POSIX interface of the same name. @@ -2688,7 +2688,7 @@ message size is limited at 22 bytes.

      2.4.2 mq_close

      -Function Prototype: +Function Prototype:

           #include <mqueue.h>
           int mq_close(mqd_t mqdes);
      @@ -2705,20 +2705,20 @@ queue via this mqdes (see mq_notify()), this attachmen
       removed and the message queue is available for another task to attach
       for notification.
       

      -Input Parameters: +Input Parameters:

      • mqdes. Message queue descriptor.

      -Returned Value: +Returned Value:

      • 0 (OK) if the message queue is closed successfully, otherwise, -1 (ERROR).

      -Assumptions/Limitations: +Assumptions/Limitations:

      • @@ -2735,7 +2735,7 @@ of the same name.

        2.4.3 mq_unlink

        -Function Prototype: +Function Prototype:

             #include <mqueue.h>
             int mq_unlink(const char *mqName);
        @@ -2748,7 +2748,7 @@ open when mq_unlink() is called, removal of the message queue
         is postponed until all references to the message queue have been
         closed.
         

        -Input Parameters: +Input Parameters:

        • mqName. Name of the message queue
        @@ -2756,14 +2756,14 @@ closed.

        Returned Value: None.

        -Assumptions/Limitations: +Assumptions/Limitations:

        POSIX Compatibility: Comparable to the POSIX interface of the same name.

        2.4.4 mq_send

        -Function Prototype: +Function Prototype:

             #include <mqueue.h>
        @@ -2808,7 +2808,7 @@ interface of the same name.
           

      - Input Parameters: + Input Parameters:

      • mqdes. Message queue descriptor.
      • @@ -2845,7 +2845,7 @@ interface of the same name.

      - Assumptions/Limitations: + Assumptions/Limitations:

      POSIX Compatibility: @@ -2853,7 +2853,7 @@ interface of the same name.

      mq_timedsend

      -Function Prototype: +Function Prototype:

           #include <mqueue.h>
      @@ -2891,7 +2891,7 @@ interface of the same name.
         of the call, mq_timedsend() returns immediately.
       

      - Input Parameters: + Input Parameters:

      • mqdes. Message queue descriptor.
      • @@ -2928,7 +2928,7 @@ interface of the same name.

      - Assumptions/Limitations: + Assumptions/Limitations:

      POSIX Compatibility: @@ -2937,7 +2937,7 @@ interface of the same name.

      2.4.5 mq_receive

      - Function Prototype: + Function Prototype:

           #include <mqueue.h>
      @@ -2962,7 +2962,7 @@ interface of the same name.
         If the queue is empty and O_NONBLOCK is set, ERROR will be returned.
       

      - Input Parameters: + Input Parameters:

      • mqdes. Message Queue Descriptor.
      • @@ -2998,7 +2998,7 @@ interface of the same name.

      - Assumptions/Limitations: + Assumptions/Limitations:

      POSIX Compatibility: @@ -3007,7 +3007,7 @@ interface of the same name.

      2.4.6 mq_timedreceive

      - Function Prototype: + Function Prototype:

           #include <mqueue.h>
      @@ -3042,7 +3042,7 @@ interface of the same name.
         the call, mq_timedreceive() returns immediately.
       

      - Input Parameters: + Input Parameters:

      • mqdes. Message Queue Descriptor.
      • @@ -3083,7 +3083,7 @@ interface of the same name.

      - Assumptions/Limitations: + Assumptions/Limitations:

      POSIX Compatibility: @@ -3093,7 +3093,7 @@ interface of the same name.

      2.4.7 mq_notify

      - Function Prototype: + Function Prototype:

           #include <mqueue.h>
           int mq_notify(mqd_t mqdes, const struct sigevent *notification);
      @@ -3135,16 +3135,16 @@ interface of the same name.
         errno set to indicate the error:
         
      • - EBADF. The descriptor specified in mqdes is invalid. + EBADF. The descriptor specified in mqdes is invalid.
      • EBUSY. Another process has already registered to receive notification - for this message queue. + for this message queue.
      • EINVAL. sevp->sigev_notify is not one of the permitted values; or sevp->sigev_notify is SIGEV_SIGNAL and sevp->sigev_signo is not a - valid signal number. + valid signal number.
      • ENOMEM. Insufficient memory. @@ -3174,7 +3174,7 @@ interface of the same name.

        2.4.8 mq_setattr

        -Function Prototype: +Function Prototype:

             #include <mqueue.h>
             int mq_setattr(mqd_t mqdes, const struct mq_attr *mqStat,
        @@ -3190,7 +3190,7 @@ If "oldMqStat" is non-null, mq_setattr() will store
         the previous message queue attributes at that location (just as
         would have been returned by mq_getattr()).
         

        -Input Parameters: +Input Parameters:

        • mqdes. Message queue descriptor
        • mqStat. New attributes @@ -3198,14 +3198,14 @@ would have been returned by mq_getattr()).

        -Returned Value: +Returned Value:

        • 0 (OK) if attributes are set successfully, otherwise -1 (ERROR).

        -Assumptions/Limitations: +Assumptions/Limitations:

        POSIX Compatibility: Comparable to the POSIX interface of the same name. @@ -3213,7 +3213,7 @@ interface of the same name.

        2.4.9 mq_getattr

        -Function Prototype: +Function Prototype:

             #include <mqueue.h>
             int mq_getattr(mqd_t mqdes, struct mq_attr *mqStat);
        @@ -3223,7 +3223,7 @@ interface of the same name.
         Description: This functions gets status information and
         attributes associated with the specified message queue.
         

        -Input Parameters: +Input Parameters:

        • mqdes. Message queue descriptor
        • mqStat. Buffer in which to return attributes. The returned @@ -3238,13 +3238,13 @@ attributes include:

        -Returned Value: +Returned Value:

        • 0 (OK) if attributes provided, -1 (ERROR) otherwise.

        -Assumptions/Limitations: +Assumptions/Limitations:

        POSIX Compatibility: Comparable to the POSIX interface of the same name. @@ -3400,7 +3400,7 @@ interface of the same name.

        2.5.1 sem_init

        -Function Prototype: +Function Prototype:

             #include <semaphore.h>
             int sem_init(sem_t *sem, int pshared, unsigned int value);
        @@ -3417,21 +3417,21 @@ result of referring to copies of sem in calls to sem_wait()sem_trywait(), sem_post(), and sem_destroy(), is
         not defined.
         

        -Input Parameters: +Input Parameters:

        • sem. Semaphore to be initialized
        • pshared. Process sharing (not used) -
        • value. Semaphore initialization value +
        • value. Semaphore initialization value

        -Returned Value: +Returned Value:

        • 0 (OK), or -1 (ERROR) if unsuccessful.

        -Assumptions/Limitations: +Assumptions/Limitations:

        POSIX Compatibility: Comparable to the POSIX interface of the same name. @@ -3443,7 +3443,7 @@ Differences from the full POSIX implementation include:

        2.5.2 sem_destroy

        -Function Prototype: +Function Prototype:

             #include <semaphore.h>
             int sem_destroy(sem_t *sem);
        @@ -3460,19 +3460,19 @@ effect of subsequent use of the semaphore sem is undefined until
         The effect of destroying a semaphore upon which other tasks are currently
         blocked is undefined.
         

        -Input Parameters: +Input Parameters:

        • sem. Semaphore to be destroyed.

        -Returned Value: +Returned Value:

        • 0 (OK), or -1 (ERROR) if unsuccessful.

        -Assumptions/Limitations: +Assumptions/Limitations:

        POSIX Compatibility: Comparable to the POSIX interface of the same name. @@ -3480,7 +3480,7 @@ interface of the same name.

        2.5.3 sem_open

        -Function Prototype: +Function Prototype:

             #include <semaphore.h>
             sem_t *sem_open(const char *name, int oflag, ...);
        @@ -3499,7 +3499,7 @@ If a task makes multiple calls to sem_open() with the same name,
         then the same semaphore address is returned (provided there have
         been no calls to sem_unlink()).
         

        -Input Parameters: +Input Parameters:

        • name. Semaphore name
        • oflag. Semaphore creation options. This may one of @@ -3516,7 +3516,7 @@ a new semaphore unless one of this name already exists. NOTE: When the O_CREAT flag is specified, POSIX requires that a third and fourth parameter be supplied:
            -
          • mode. The mode parameter is of type mode_t. +
          • mode. The mode parameter is of type mode_t. This parameter is required but not used in the present implementation.
          • value. The value parameter is type unsigned int. The semaphore @@ -3527,13 +3527,13 @@ semaphores must be less than or equal to SEM_VALUE_MAX (defined in

          -Returned Value: +Returned Value:

          • A pointer to sem_t or -1 (ERROR) if unsuccessful.

          -Assumptions/Limitations: +Assumptions/Limitations:

          POSIX Compatibility: Comparable to the POSIX interface of the same name. @@ -3546,7 +3546,7 @@ just a counting semaphore.

          2.5.4 sem_close

          -Function Prototype: +Function Prototype:

               #include <semaphore.h>
               int sem_close(sem_t *sem);
          @@ -3566,13 +3566,13 @@ will vanish when the last task closes it.
           Care must be taken to avoid risking the deletion of a semaphore
           that another calling task has already locked.
           

          -Input Parameters: +Input Parameters:

          • sem. Semaphore descriptor

          -Returned Value: +Returned Value:

          • 0 (OK), or -1 (ERROR) if unsuccessful.
          @@ -3591,7 +3591,7 @@ interface of the same name.

          2.5.5 sem_unlink

          -Function Prototype: +Function Prototype:

               #include <semaphore.h>
               int sem_unlink(const char *name);
          @@ -3604,19 +3604,19 @@ name open when sem_unlink() is called, destruction of the semaphore will
           be postponed until all references have been destroyed by calls to
           sem_close().
           

          -Input Parameters: +Input Parameters:

          • name. Semaphore name

          -Returned Value: +Returned Value:

          • 0 (OK), or -1 (ERROR) if unsuccessful.

          -Assumptions/Limitations: +Assumptions/Limitations:

          • Care must be taken to avoid deletion of a semaphore that another task has already locked. @@ -3637,7 +3637,7 @@ same name should be created after sem_unlink() is called.

            2.5.6 sem_wait

            -Function Prototype: +Function Prototype:

                 #include <semaphore.h>
                 int sem_wait(sem_t *sem);
            @@ -3649,13 +3649,13 @@ referenced by sem. If the semaphore as already locked by another
             task, the calling task will not return until it either successfully acquires
             the lock or the call is interrupted by a signal.
             

            -Input Parameters: +Input Parameters:

            • sem. Semaphore descriptor.

            -Returned Value: +Returned Value:

            • 0 (OK), or -1 (ERROR) is unsuccessful
            @@ -3671,7 +3671,7 @@ not valid. received by this task. In this case, the semaphore has not be acquired.

          -Assumptions/Limitations: +Assumptions/Limitations:

          POSIX Compatibility: Comparable to the POSIX interface of the same name. @@ -3679,7 +3679,7 @@ interface of the same name.

          2.5.7 sem_timedwait

          -Function Prototype: +Function Prototype:

               #include <semaphore.h>
               #include <time.h>
          @@ -3687,7 +3687,7 @@ interface of the same name.
           

          -Description: +Description: This function will lock the semaphore referenced by sem as in the sem_wait() function. However, if the semaphore cannot be locked without waiting for another process or thread to unlock the semaphore by performing a sem_post() function, this wait will be terminated when the specified timeout expires.

          @@ -3695,7 +3695,7 @@ interface of the same name. This function attempts to lock the semaphore referenced by sem. If the semaphore as already locked by another task, the calling task will not return until it either successfully acquires the lock or the call is interrupted by a signal.

          -Input Parameters: +Input Parameters:

          • sem. Semaphore descriptor. @@ -3706,7 +3706,7 @@ interface of the same name.

          -Returned Value: +Returned Value:

          • 0 (OK), or -1 (ERROR) is unsuccessful
          @@ -3748,7 +3748,7 @@ The following lists the possible values for errno2.5.8 sem_trywait

          -Function Prototype: +Function Prototype:

               #include <semaphore.h>
               int sem_trywait(sem_t *sem);
          @@ -3759,13 +3759,13 @@ The following lists the possible values for errno
          -Input Parameters: 
          +Input Parameters:
           
          • sem. The semaphore descriptor

          -Returned Value: +Returned Value:

          • 0 (OK) or -1 (ERROR) if unsuccessful
          @@ -3781,7 +3781,7 @@ not valid.

          -Assumptions/Limitations: +Assumptions/Limitations:

          POSIX Compatibility: Comparable to the POSIX interface of the same name. @@ -3789,7 +3789,7 @@ interface of the same name.

          2.5.9 sem_post

          -Function Prototype: +Function Prototype:

               #include <semaphore.h>
               int sem_post(sem_t *sem);
          @@ -3810,13 +3810,13 @@ return successfully from its call to sem_wait().
           

          NOTE: sem_post() may be called from an interrupt handler.

          -Input Parameters: +Input Parameters:

          • sem. Semaphore descriptor

          -Returned Value: +Returned Value:

          • 0 (OK) or -1 (ERROR) if unsuccessful.
          @@ -3832,7 +3832,7 @@ interface of the same name.

          2.5.10 sem_getvalue

          -Function Prototype: +Function Prototype:

               #include <semaphore.h>
               int sem_getvalue(sem_t *sem, int *sval);
          @@ -3850,20 +3850,20 @@ If sem is locked, the value return by sem_getvalue() will either
           be zero or a negative number whose absolute value represents the
           number of tasks waiting for the semaphore.
           

          -Input Parameters: +Input Parameters:

          • sem. Semaphore descriptor
          • sval. Buffer by which the value is returned

          -Returned Value: +Returned Value:

          • 0 (OK) or -1 (ERROR) if unsuccessful.

          -Assumptions/Limitations: +Assumptions/Limitations:

          POSIX Compatibility: Comparable to the POSIX interface of the same name. @@ -3897,7 +3897,7 @@ interface of the same name.

          2.6.1 wd_create

          -Function Prototype: +Function Prototype:

               #include <wdog.h>
               WDOG_ID wd_create(void);
          @@ -3909,7 +3909,7 @@ by allocating the appropriate resources for the watchdog.
           

          Input Parameters: None.

          -Returned Value: +Returned Value:

          • Pointer to watchdog that may be used as a handle in subsequent NuttX calls (i.e., the watchdog ID), or NULL if insufficient resources @@ -3917,7 +3917,7 @@ are available to create the watchdogs.

          -Assumptions/Limitations: +Assumptions/Limitations:

          POSIX Compatibility: This is a NON-POSIX interface. VxWorks provides the following comparable interface: @@ -3935,7 +3935,7 @@ initialization time).

          2.6.2 wd_delete

          -Function Prototype: +Function Prototype:

               #include <wdog.h>
               int wd_delete(WDOG_ID wdog);
          @@ -3946,14 +3946,14 @@ initialization time).
           watchdog. The watchdog will be removed from the timer queue if
           has been started.
           

          -Input Parameters: +Input Parameters:

          • wdog. The watchdog ID to delete. This is actually a pointer to a watchdog structure.

          -Returned Value: +Returned Value:

          • OK or ERROR
          @@ -3979,7 +3979,7 @@ before deallocating it (i.e., never returns ERROR).

          2.6.3 wd_start

          -Function Prototype: +Function Prototype:

               #include <wdog.h>
               int wd_start(WDOG_ID wdog, int delay, wdentry_t wdentry,
          @@ -4000,7 +4000,7 @@ To replace either the timeout delay or the function to be executed,
           call wd_start again with the same wdog; only the most recent
           wd_start() on a given watchdog ID has any effect.
           

          -Input Parameters: +Input Parameters:

          • wdog. Watchdog ID
          • delay. Delay count in clock ticks @@ -4010,7 +4010,7 @@ wd_start() on a given watchdog ID has any effect.

          -Returned Value: +Returned Value:

          • OK or ERROR
          @@ -4031,12 +4031,12 @@ Differences from the VxWorks interface include:
          • The present implementation supports multiple parameters passed to wdentry; VxWorks supports only a single parameter. The maximum -number of parameters is determined by +number of parameters is determined by

          2.6.4 wd_cancel

          -Function Prototype: +Function Prototype:

               #include <wdog.h>
               int wd_cancel(WDOG_ID wdog);
          @@ -4047,19 +4047,19 @@ number of parameters is determined by
           watchdog timer. Watchdog timers may be canceled from the interrupt
           level.
           

          -Input Parameters: +Input Parameters:

          • wdog. ID of the watchdog to cancel.

          -Returned Value: +Returned Value:

          • OK or ERROR

          -Assumptions/Limitations: +Assumptions/Limitations:

          POSIX Compatibility: This is a NON-POSIX interface. VxWorks provides the following comparable interface: @@ -4076,7 +4076,7 @@ VxWorks provides the following comparable interface: Sint wd_gettime(WDOG_ID wdog);

          - Description: + Description: This function returns the time remaining before the specified watchdog expires.

          @@ -4086,7 +4086,7 @@ VxWorks provides the following comparable interface:

        - Returned Value: + Returned Value: The time in system ticks remaining until the watchdog time expires. Zero means either that wdog is not valid or that the wdog has already expired.

        @@ -4483,7 +4483,7 @@ VxWorks provides the following comparable interface:

        If the timer_gettime() succeeds, a value of 0 (OK) will be returned. - If an error occurs, the value -1 (ERROR) will be returned, and + If an error occurs, the value -1 (ERROR) will be returned, and errno set to indicate the error.

          @@ -4564,7 +4564,7 @@ VxWorks provides the following comparable interface: timer_getoverrun() function will return the timer expiration overrun count for the specified timer. The overrun count returned contains the number of extra timer expirations that occurred between the time the signal was generated - (queued) and when it was delivered or accepted, up to but not including an + (queued) and when it was delivered or accepted, up to but not including an implementation-defined maximum of DELAYTIMER_MAX. If the number of such extra expirations is greater than or equal to DELAYTIMER_MAX, then the overrun count will be set to DELAYTIMER_MAX. The value returned by @@ -4722,7 +4722,7 @@ interface of the same name.

          2.8.1 sigemptyset

          -Function Prototype: +Function Prototype:

               #include <signal.h>
               int sigemptyset(sigset_t *set);
          @@ -4732,19 +4732,19 @@ interface of the same name.
           Description: This function initializes the signal set specified
           by set such that all signals are excluded.
           

          -Input Parameters: +Input Parameters:

          • set. Signal set to initialize.

          -Returned Value: +Returned Value:

          • 0 (OK), or -1 (ERROR) if the signal set cannot be initialized.

          -Assumptions/Limitations: +Assumptions/Limitations:

          POSIX Compatibility: Comparable to the POSIX interface of the same name. @@ -4752,7 +4752,7 @@ interface of the same name.

          2.8.2 sigfillset

          -Function Prototype: +Function Prototype:

               #include <signal.h>
               int sigfillset(sigset_t *set);
          @@ -4762,19 +4762,19 @@ interface of the same name.
           Description: This function initializes the signal set specified
           by set such that all signals are included.
           

          -Input Parameters: +Input Parameters:

          • set. Signal set to initialize

          -Returned Value: +Returned Value:

          • 0 (OK), or -1 (ERROR) if the signal set cannot be initialized.

          -Assumptions/Limitations: +Assumptions/Limitations:

          POSIX Compatibility: Comparable to the POSIX interface of the same name. @@ -4782,7 +4782,7 @@ interface of the same name.

          2.8.3 sigaddset

          -Function Prototype: +Function Prototype:

               #include <signal.h>
               int sigaddset(sigset_t *set, int signo);
          @@ -4792,20 +4792,20 @@ interface of the same name.
           Description: This function adds the signal specified by
           signo to the signal set specified by set.
           

          -Input Parameters: +Input Parameters:

          • set. Signal set to add signal to
          • signo. Signal to add

          -Returned Value: +Returned Value:

          • 0 (OK), or -1 (ERROR) if the signal number is invalid.

          -Assumptions/Limitations: +Assumptions/Limitations:

          POSIX Compatibility: Comparable to the POSIX interface of the same name. @@ -4813,7 +4813,7 @@ interface of the same name.

          2.8.4 sigdelset

          -Function Prototype: +Function Prototype:

               #include <signal.h>
               int sigdelset(sigset_t *set, int signo);
          @@ -4823,20 +4823,20 @@ interface of the same name.
           Description: This function deletes the signal specified
           by signo from the signal set specified by set.
           

          -Input Parameters: +Input Parameters:

          • set. Signal set to delete the signal from
          • signo. Signal to delete

          -Returned Value: +Returned Value:

          • 0 (OK), or -1 (ERROR) if the signal number is invalid.

          -Assumptions/Limitations: +Assumptions/Limitations:

          POSIX Compatibility: Comparable to the POSIX interface of the same name. @@ -4844,7 +4844,7 @@ interface of the same name.

          2.8.5 sigismember

          -Function Prototype: +Function Prototype:

               #include <signal.h>
               int  sigismember(const sigset_t *set, int signo);
          @@ -4854,14 +4854,14 @@ interface of the same name.
           Description: This function tests whether the signal specified
           by signo is a member of the set specified by set.
           

          -Input Parameters: +Input Parameters:

          • set. Signal set to test
          • signo. Signal to test for

          -Returned Value: +Returned Value:

          • 1 (TRUE), if the specified signal is a member of the set,
          • 0 (OK or FALSE), if it is not, or @@ -4869,7 +4869,7 @@ by signo is a member of the set specified by set.

          -Assumptions/Limitations: +Assumptions/Limitations:

          POSIX Compatibility: Comparable to the POSIX interface of the same name. @@ -4877,7 +4877,7 @@ interface of the same name.

          2.8.6 sigaction

          -Function Prototype: +Function Prototype:

               #include <signal.h>
               int sigaction(int signo, const struct sigaction *act,
          @@ -4921,7 +4921,7 @@ Once an action is installed for a specific signal, it remains installed
           until another action is explicitly requested by another call to
           sigaction().
           

          -Input Parameters: +Input Parameters:

          • sig. Signal of interest
          • act. Location of new handler @@ -4929,13 +4929,13 @@ sigaction().

          -Returned Value: +Returned Value:

          • 0 (OK), or -1 (ERROR) if the signal number is invalid.

          -Assumptions/Limitations: +Assumptions/Limitations:

          POSIX Compatibility: Comparable to the POSIX interface of the same name. @@ -4954,7 +4954,7 @@ Differences from the POSIX implementation include:

          2.8.7 sigprocmask

          -Function Prototype: +Function Prototype:

               #include <signal.h>
               int sigprocmask(int how, const sigset_t *set, sigset_t *oset);
          @@ -4972,7 +4972,7 @@ those signals will be delivered before sigprocmask() returns.
           

          If sigprocmask() fails, the signal mask of the task is not changed.

          -Input Parameters: +Input Parameters:

          • how. How the signal mast will be changed:
              @@ -4990,13 +4990,13 @@ pointed to by the set input parameter.

            -Returned Value: +Returned Value:

            • 0 (OK), or -1 (ERROR) if how is invalid.

            -Assumptions/Limitations: +Assumptions/Limitations:

            POSIX Compatibility: Comparable to the POSIX interface of the same name. @@ -5004,7 +5004,7 @@ interface of the same name.

            2.8.8 sigpending

            -Function Prototype: +Function Prototype:

                 #include <signal.h>
                 int sigpending(sigset_t *set);
            @@ -5022,19 +5022,19 @@ with POSIX which states:  "If a subsequent occurrence of a pending
             signal is generated, it is implementation defined as to whether the signal
             is delivered more than once."
             

            -Input Parameters: +Input Parameters:

            • set. The location to return the pending signal set.

            -Returned Value: +Returned Value:

            • 0 (OK) or -1 (ERROR)

            -Assumptions/Limitations: +Assumptions/Limitations:

            POSIX Compatibility: Comparable to the POSIX interface of the same name. @@ -5042,7 +5042,7 @@ interface of the same name.

            2.8.9 sigsuspend

            -Function Prototype: +Function Prototype:

                 #include <signal.h>
                 int sigsuspend(const sigset_t *set);
            @@ -5068,13 +5068,13 @@ suspended.
             

          -Returned Value: +Returned Value:

          • -1 (ERROR) always

          -Assumptions/Limitations: +Assumptions/Limitations:

          POSIX Compatibility: Comparable to the POSIX interface of the same name. @@ -5090,7 +5090,7 @@ is required in the present implementation (even if the signal is ignored).

          2.8.10 sigwaitinfo

          -Function Prototype: +Function Prototype:

               #include <signal.h>
               int sigwaitinfo(const sigset_t *set, struct siginfo *info);
          @@ -5100,21 +5100,21 @@ is required in the present implementation (even if the signal is ignored).
           Description: This function is equivalent to sigtimedwait()
           with a NULL timeout parameter. (see below).
           

          -Input Parameters: +Input Parameters:

          • set. The set of pending signals to wait for.
          • info. The returned signal values

          -Returned Value: +Returned Value:

          • Signal number that cause the wait to be terminated, otherwise -1 (ERROR) is returned.

          -Assumptions/Limitations: +Assumptions/Limitations:

          POSIX Compatibility: Comparable to the POSIX interface of the same name. @@ -5122,7 +5122,7 @@ interface of the same name.

          2.8.11 sigtimedwait

          -Function Prototype: +Function Prototype:

               #include <signal.h>
               int sigtimedwait(const sigset_t *set, struct siginfo *info,
          @@ -5148,12 +5148,12 @@ for si_code are defined in signal.h:
             
        • SI_USER. Signal sent from kill, raise, or abort
        • SI_QUEUE. Signal sent from sigqueue
        • SI_TIMER. Signal is result of timer expiration -
        • SI_ASYNCIO. Signal is the result of asynchronous IO completion +
        • SI_ASYNCIO. Signal is the result of asynchronous IO completion
        • SI_MESGQ. Signal generated by arrival of a message on an empty message queue.

        -Input Parameters: +Input Parameters:

        • set. The set of pending signals to wait for.
        • info. The returned signal values @@ -5161,14 +5161,14 @@ for si_code are defined in signal.h:

        -Returned Value: +Returned Value:

        • Signal number that cause the wait to be terminated, otherwise -1 (ERROR) is returned.

        -Assumptions/Limitations: +Assumptions/Limitations:

        POSIX Compatibility: Comparable to the POSIX interface of the same name. @@ -5188,7 +5188,7 @@ the unblocked signal is ignored.

        2.8.12 sigqueue

        -Function Prototype: +Function Prototype:

             #include <signal.h>
             int sigqueue (int tid, int signo, union sigval value);
        @@ -5206,7 +5206,7 @@ POSIX which states:  "If a subsequent occurrence of a pending signal
         is generated, it is implementation defined as to whether the signal
         is delivered more than once."
         

        -Input Parameters: +Input Parameters:

        • tid. ID of the task to receive signal
        • signo. Signal number @@ -5214,7 +5214,7 @@ is delivered more than once."

        -Returned Value: +Returned Value:

        • On success (at least one signal was sent), zero (OK) is returned. @@ -5228,7 +5228,7 @@ is delivered more than once."

        -Assumptions/Limitations: +Assumptions/Limitations:

        POSIX Compatibility: Comparable to the POSIX interface of the same name. @@ -5245,7 +5245,7 @@ be sent.

        2.8.13 kill

        -Function Prototype: +Function Prototype:

            #include <sys/types.h>
            #include <signal.h>
        @@ -5253,7 +5253,7 @@ be sent.
         

        -Description: +Description: The kill() system call can be used to send any signal to any task.

        @@ -5266,7 +5266,7 @@ be sent. is delivered more than once."

        -Input Parameters: +Input Parameters:

        • pid. The id of the task to receive the signal. The POSIX kill() specification encodes process group @@ -5278,14 +5278,14 @@ be sent.

        - Returned Value: + Returned Value:

        • OK or ERROR

        - Assumptions/Limitations: + Assumptions/Limitations:

        POSIX Compatibility: @@ -5301,29 +5301,29 @@ be sent.

        2.8.14 pause

        -Function Prototype: +Function Prototype:

            #include <unistd.h>
            int pause(void);
         

        -Description: +Description: The pause() function will suspend the calling thread until delivery of a non-blocked signal.

        -Input Parameters: +Input Parameters:
        • None

        - Returned Value: + Returned Value: Since pause() suspends thread execution indefinitely unless interrupted a signal, there is no successful completion return value. A value of -1 (ERROR will always be returned and errno set to indicate the error (EINTR).

        - Assumptions/Limitations: + Assumptions/Limitations:

        POSIX Compatibility: @@ -5405,7 +5405,7 @@ be sent.

      • 2.9.28 pthread_mutexattr_getpshared
      • 2.9.29 pthread_mutexattr_setpshared
      • 2.9.30 pthread_mutexattr_gettype
      • -
      • 2.9.31 pthread_mutexattr_settype
      • +
      • 2.9.31 pthread_mutexattr_settype
      • 2.9.32 pthread_mutex_init
      • 2.9.33 pthread_mutex_destroy
      • 2.9.34 pthread_mutex_lock
      • @@ -6004,7 +6004,7 @@ cancellation state is set to PTHREAD_CANCEL_ENABLE.

        Input Parameters:

          -
        • state +
        • state New cancellation state. One of PTHREAD_CANCEL_ENABLE or PTHREAD_CANCEL_DISABLE.<.li>
        • oldstate. Location to return the previous cancellation state. @@ -6164,7 +6164,7 @@ interface of the same name.

        Description: - The pthread_getschedparam() functions will get the + The pthread_getschedparam() functions will get the scheduling policy and parameters of threads. For SCHED_FIFO and SCHED_RR, the only required member of the sched_param structure is the @@ -7321,7 +7321,7 @@ interface of the same name. Description: The pthread_barrier_init() function allocates any resources required to use the barrier referenced by barrier and initialized the barrier with - the attributes referenced by attr. + the attributes referenced by attr. If attr is NULL, the default barrier attributes will be used. The results are undefined if pthread_barrier_init() is called when any thread is blocked on the barrier. @@ -7444,7 +7444,7 @@ interface of the same name. recent pthread_barrier_init() function that referenced it.

        - The constant PTHREAD_BARRIER_SERIAL_THREAD is defined in + The constant PTHREAD_BARRIER_SERIAL_THREAD is defined in pthread.h and its value must be distinct from any other value returned by pthread_barrier_wait().

        @@ -7879,7 +7879,7 @@ interface of the same name.

        Any user supplied data or logic can be accessed via the pseudo-file system. - Built in support is provided for character and block + Built in support is provided for character and block driver nodes in the any pseudo file system directory. (By convention, however, all driver nodes should be in the /dev @@ -7937,8 +7937,8 @@ interface of the same name.

             #include <unistd.h>
             int     close(int fd);
          -  int     dup(int fildes);
          -  int     dup2(int fildes1, int fildes2);
          +  int     dup(int fd);
          +  int     dup2(int fd1, int fd2);
             off_t   lseek(int fd, off_t offset, int whence);
             ssize_t read(int fd, void *buf, size_t nbytes);
             int     unlink(const char *path);
          @@ -8103,7 +8103,7 @@ off_t   lseek(int fd, off_t offset, int whence);
           ssize_t read(int fd, FAR void *buf, size_t nbytes);
           ssize_t write(int fd, FAR const void *buf, size_t nbytes);
           
          -int     pipe(int filedes[2]);
          +int     pipe(int fd[2]);
           
           int     chdir(FAR const char *path);
           FAR char *getcwd(FAR char *buf, size_t size);
          @@ -8224,22 +8224,22 @@ void  *memmove(void *dest, const void *src, size_t count);
           

             #include <unistd.h>
            -int pipe(int filedes[2]);
            +int pipe(int fd[2]);
             

          Description:

            pipe() creates a pair of file descriptors, pointing to a pipe inode, and - places them in the array pointed to by filedes. - filedes[0] is for reading, filedes[1] is for writing. + places them in the array pointed to by fd. + fd[0] is for reading, fd[1] is for writing.

          Input Parameters:

            -
          • filedes[2]. The user provided array in which to catch the pipe file descriptors.
          • +
          • fd[2]. The user provided array in which to catch the pipe file descriptors.

          @@ -8266,7 +8266,7 @@ int mkfifo(FAR const char *pathname, mode_t mode);

          mkfifo() makes a FIFO device driver file with name pathname. Unlike Linux, a NuttX FIFO is not a special file type but simply a device driver instance. - mode specifies the FIFO's permissions (but is ignored in the current implementation). + mode specifies the FIFO's permissions (but is ignored in the current implementation).

          Once the FIFO has been created by mkfifo(), any thread can open it for @@ -8316,7 +8316,7 @@ int mkfatfs(FAR const char *pathname, FAR struct fat_format_s *fmt); device specified by pathname

          Assumptions: The caller must assure that the block driver is not mounted and not in - use when this function is called. + use when this function is called. The result of formatting a mounted device is indeterminate (but likely not good).

        @@ -8363,7 +8363,7 @@ struct fat_format_s NULL block driver string, bad number of FATS in fmt, bad FAT size in fmt, bad cluster size in fmt
      • -
      • ENOENT - +
      • ENOENT - pathname does not refer to anything in the file-system.
      • ENOTBLK - @@ -8387,7 +8387,7 @@ struct fat_format_s

        However, memory mapping of files is the mechanism used by NXFLAT, the NuttX tiny binary format, to get files into memory in order to execute them. - mmap() support is therefore required to support NXFLAT. + mmap() support is therefore required to support NXFLAT. There are two conditions where mmap() can be supported:

          @@ -8618,7 +8618,7 @@ FAR void *mmap(FAR void *start, size_t length, int prot, int flags, int fd, off_
        1. ENOSYS - Returned if any of the unsupported mmap() features are attempted.
        2. -
        3. EBADF - +
        4. EBADF - fd is not a valid file descriptor.
        5. EINVAL - @@ -8862,7 +8862,7 @@ int listen(int sockfd, int backlog);
        6. ENOTSOCK: The argument sockfd is not a socket.
        7. EOPNOTSUPP: The socket is not of a type that supports the listen operation.
      - +

      2.12.5 accept

      Function Prototype: diff --git a/arch/arm/src/c5471/c5471_watchdog.c b/arch/arm/src/c5471/c5471_watchdog.c index 83563def7ff..f9cf52244cc 100644 --- a/arch/arm/src/c5471/c5471_watchdog.c +++ b/arch/arm/src/c5471/c5471_watchdog.c @@ -1,7 +1,7 @@ /************************************************************************** - * c5471/c5471_watchdog.c + * arch/arm/src/c5471/c5471_watchdog.c * - * Copyright (C) 2007, 2009, 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2009, 2012-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -100,7 +100,7 @@ static int wdt_open(struct file *filep); static int wdt_close(struct file *filep); static ssize_t wdt_read(struct file *filep, char *buffer, size_t buflen); static ssize_t wdt_write(struct file *filep, const char *buffer, size_t buflen); -static int wdt_ioctl(FAR struct file *filp, int cmd, unsigned long arg); +static int wdt_ioctl(FAR struct file *filep, int cmd, unsigned long arg); /************************************************************************** * Private Data @@ -190,7 +190,7 @@ static int wdt_setusec(uint32_t usec) if (divisor >= 0x10000) { if (prescaler == MAX_PRESCALER) - { + { /* This is the max possible ~2.5 seconds. */ dbg("prescaler=0x%x too big!\n", prescaler); @@ -289,7 +289,7 @@ static ssize_t wdt_write(struct file *filep, const char *buffer, size_t buflen) * Name: wdt_ioctl **************************************************************************/ -static int wdt_ioctl(FAR struct file *filp, int cmd, unsigned long arg) +static int wdt_ioctl(FAR struct file *filep, int cmd, unsigned long arg) { dbg("ioctl Call: cmd=0x%x arg=0x%x", cmd, arg); diff --git a/arch/arm/src/common/up_exit.c b/arch/arm/src/common/up_exit.c index 95a71f832ac..34dc3138aec 100644 --- a/arch/arm/src/common/up_exit.c +++ b/arch/arm/src/common/up_exit.c @@ -104,14 +104,14 @@ static void _up_dumponexit(FAR struct tcb_s *tcb, FAR void *arg) for (i = 0; i < CONFIG_NFILE_STREAMS; i++) { struct file_struct *filep = &streamlist->sl_streams[i]; - if (filep->fs_filedes >= 0) + if (filep->fs_fd >= 0) { #if CONFIG_STDIO_BUFFER_SIZE > 0 sdbg(" fd=%d nbytes=%d\n", - filep->fs_filedes, + filep->fs_fd, filep->fs_bufpos - filep->fs_bufstart); #else - sdbg(" fd=%d\n", filep->fs_filedes); + sdbg(" fd=%d\n", filep->fs_fd); #endif } } diff --git a/arch/arm/src/lpc2378/lpc23xx_io.c b/arch/arm/src/lpc2378/lpc23xx_io.c index 6f0474f09a3..ff9ed418d88 100644 --- a/arch/arm/src/lpc2378/lpc23xx_io.c +++ b/arch/arm/src/lpc2378/lpc23xx_io.c @@ -1,101 +1,101 @@ -/*********************************************************************** - * arch/arm/src/arm/lpc2378/lpc23xx_head.S - * - * Copyright (C) 2010 Rommel Marcelo. All rights reserved. - * Author: Rommel Marcelo - * - * This file is part of the NuttX RTOS: - * - * Copyright (C) 2010 Gregory Nutt. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ***********************************************************************/ - -/*********************************************************************** - * Included files - ***********************************************************************/ - -#include "up_arch.h" -#include -#include "lpc23xx_scb.h" -#include "lpc23xx_pinsel.h" -#include "lpc23xx_uart.h" -#include "lpc23xx_gpio.h" - -/*********************************************************************** - * Definitions - ***********************************************************************/ - -/*********************************************************************** -* Name: IO_Init() -* -* Descriptions: Initialize the target board before running the main() -* -************************************************************************/ -void IO_Init( void ) -{ - uint32_t regval; - - /* Reset all GPIO pins to default */ - - pinsel_putreg(0, PINSEL0_OFFSET); - pinsel_putreg(0, PINSEL1_OFFSET); - pinsel_putreg(0, PINSEL2_OFFSET); - pinsel_putreg(0, PINSEL3_OFFSET); - pinsel_putreg(0, PINSEL4_OFFSET); - pinsel_putreg(0, PINSEL5_OFFSET); - pinsel_putreg(0, PINSEL6_OFFSET); - pinsel_putreg(0, PINSEL7_OFFSET); - pinsel_putreg(0, PINSEL8_OFFSET); - pinsel_putreg(0, PINSEL9_OFFSET); - pinsel_putreg(0, PINSEL10_OFFSET); - -/* - regval = scb_getreg(SCB_PCONP_OFFSET) & ~(PCSDC | PCUART1 | PCI2C0 | PCSSP1 | PCEMC | ); - scb_getreg(regval, SCB_PCONP_OFFSET ); -*/ - - /* Turn off all peripheral power */ - - scb_putreg(0, SCB_PCONP_OFFSET ); - - /* Turn on UART0/2 / Timer0 */ - /* regval = PCUART0 | PCUART2 | PCTIM0 | PCRTC ; */ - - regval = PCUART0 | PCUART2 | PCTIM0 ; - scb_putreg(regval , SCB_PCONP_OFFSET ); - - /* Status LED P1.19 */ - - dir_putreg8((1 << 3), FIO1DIR2_OFFSET); - - /* other io setup here */ - - return; -} +/*********************************************************************** + * arch/arm/src/arm/lpc2378/lpc23xx_head.S + * + * Copyright (C) 2010 Rommel Marcelo. All rights reserved. + * Author: Rommel Marcelo + * + * This file is part of the NuttX RTOS: + * + * Copyright (C) 2010 Gregory Nutt. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ***********************************************************************/ + +/*********************************************************************** + * Included files + ***********************************************************************/ + +#include "up_arch.h" +#include +#include "lpc23xx_scb.h" +#include "lpc23xx_pinsel.h" +#include "lpc23xx_uart.h" +#include "lpc23xx_gpio.h" + +/*********************************************************************** + * Definitions + ***********************************************************************/ + +/*********************************************************************** +* Name: IO_Init() +* +* Descriptions: Initialize the target board before running the main() +* +************************************************************************/ +void IO_Init( void ) +{ + uint32_t regval; + + /* Reset all GPIO pins to default */ + + pinsel_putreg(0, PINSEL0_OFFSET); + pinsel_putreg(0, PINSEL1_OFFSET); + pinsel_putreg(0, PINSEL2_OFFSET); + pinsel_putreg(0, PINSEL3_OFFSET); + pinsel_putreg(0, PINSEL4_OFFSET); + pinsel_putreg(0, PINSEL5_OFFSET); + pinsel_putreg(0, PINSEL6_OFFSET); + pinsel_putreg(0, PINSEL7_OFFSET); + pinsel_putreg(0, PINSEL8_OFFSET); + pinsel_putreg(0, PINSEL9_OFFSET); + pinsel_putreg(0, PINSEL10_OFFSET); + +/* + regval = scb_getreg(SCB_PCONP_OFFSET) & ~(PCSDC | PCUART1 | PCI2C0 | PCSSP1 | PCEMC | ); + scb_getreg(regval, SCB_PCONP_OFFSET ); +*/ + + /* Turn off all peripheral power */ + + scb_putreg(0, SCB_PCONP_OFFSET ); + + /* Turn on UART0/2 / Timer0 */ + /* regval = PCUART0 | PCUART2 | PCTIM0 | PCRTC ; */ + + regval = PCUART0 | PCUART2 | PCTIM0 ; + scb_putreg(regval , SCB_PCONP_OFFSET ); + + /* Status LED P1.19 */ + + dir_putreg8((1 << 3), FIO1DIR2_OFFSET); + + /* other io setup here */ + + return; +} diff --git a/arch/avr/src/common/up_exit.c b/arch/avr/src/common/up_exit.c index 93ec7c487b2..d2a4f85a98e 100644 --- a/arch/avr/src/common/up_exit.c +++ b/arch/avr/src/common/up_exit.c @@ -104,14 +104,14 @@ static void _up_dumponexit(FAR struct tcb_s *tcb, FAR void *arg) for (i = 0; i < CONFIG_NFILE_STREAMS; i++) { struct file_struct *filep = &streamlist->sl_streams[i]; - if (filep->fs_filedes >= 0) + if (filep->fs_fd >= 0) { #if CONFIG_STDIO_BUFFER_SIZE > 0 sdbg(" fd=%d nbytes=%d\n", - filep->fs_filedes, + filep->fs_fd, filep->fs_bufpos - filep->fs_bufstart); #else - sdbg(" fd=%d\n", filep->fs_filedes); + sdbg(" fd=%d\n", filep->fs_fd); #endif } } diff --git a/arch/hc/src/common/up_exit.c b/arch/hc/src/common/up_exit.c index c71bbafd139..e015cf1d529 100644 --- a/arch/hc/src/common/up_exit.c +++ b/arch/hc/src/common/up_exit.c @@ -104,14 +104,14 @@ static void _up_dumponexit(FAR struct tcb_s *tcb, FAR void *arg) for (i = 0; i < CONFIG_NFILE_STREAMS; i++) { struct file_struct *filep = &streamlist->sl_streams[i]; - if (filep->fs_filedes >= 0) + if (filep->fs_fd >= 0) { #if CONFIG_STDIO_BUFFER_SIZE > 0 sdbg(" fd=%d nbytes=%d\n", - filep->fs_filedes, + filep->fs_fd, filep->fs_bufpos - filep->fs_bufstart); #else - sdbg(" fd=%d\n", filep->fs_filedes); + sdbg(" fd=%d\n", filep->fs_fd); #endif } } diff --git a/arch/mips/src/common/up_exit.c b/arch/mips/src/common/up_exit.c index 974bdc6131d..41fe57a6d97 100644 --- a/arch/mips/src/common/up_exit.c +++ b/arch/mips/src/common/up_exit.c @@ -106,14 +106,14 @@ static void _up_dumponexit(FAR struct tcb_s *tcb, FAR void *arg) for (i = 0; i < CONFIG_NFILE_STREAMS; i++) { struct file_struct *filep = &streamlist->sl_streams[i]; - if (filep->fs_filedes >= 0) + if (filep->fs_fd >= 0) { #if CONFIG_STDIO_BUFFER_SIZE > 0 sdbg(" fd=%d nbytes=%d\n", - filep->fs_filedes, + filep->fs_fd, filep->fs_bufpos - filep->fs_bufstart); #else - sdbg(" fd=%d\n", filep->fs_filedes); + sdbg(" fd=%d\n", filep->fs_fd); #endif } } diff --git a/arch/rgmp/src/bridge.c b/arch/rgmp/src/bridge.c index 2d09448316d..640e73788df 100644 --- a/arch/rgmp/src/bridge.c +++ b/arch/rgmp/src/bridge.c @@ -49,16 +49,17 @@ #include #include -struct bridge { +struct bridge +{ struct rgmp_bridge *b; sem_t rd_lock; sem_t wr_lock; }; -static ssize_t up_bridge_read(struct file *filp, char *buffer, size_t len) +static ssize_t up_bridge_read(struct file *filep, char *buffer, size_t len) { ssize_t ret; - struct bridge *b = filp->f_inode->i_private; + struct bridge *b = filep->f_inode->i_private; sem_wait(&b->rd_lock); ret = rgmp_bridge_read(b->b, buffer, len, 0); @@ -66,10 +67,10 @@ static ssize_t up_bridge_read(struct file *filp, char *buffer, size_t len) return ret; } -static ssize_t up_bridge_write(struct file *filp, const char *buffer, size_t len) +static ssize_t up_bridge_write(struct file *filep, const char *buffer, size_t len) { ssize_t ret; - struct bridge *b = filp->f_inode->i_private; + struct bridge *b = filep->f_inode->i_private; sem_wait(&b->wr_lock); ret = rgmp_bridge_write(b->b, (char *)buffer, len, 0); @@ -77,17 +78,18 @@ static ssize_t up_bridge_write(struct file *filp, const char *buffer, size_t len return ret; } -static int up_bridge_open(struct file *filp) +static int up_bridge_open(struct file *filep) { return 0; } -static int up_bridge_close(struct file *filp) +static int up_bridge_close(struct file *filep) { return 0; } -static const struct file_operations up_bridge_fops = { +static const struct file_operations up_bridge_fops = +{ .read = up_bridge_read, .write = up_bridge_write, .open = up_bridge_open, @@ -127,5 +129,3 @@ err1: err0: return -1; } - - diff --git a/arch/sh/src/common/up_exit.c b/arch/sh/src/common/up_exit.c index e454d1b6432..d7de0154cd8 100644 --- a/arch/sh/src/common/up_exit.c +++ b/arch/sh/src/common/up_exit.c @@ -105,14 +105,14 @@ static void _up_dumponexit(FAR struct tcb_s *tcb, FAR void *arg) for (i = 0; i < CONFIG_NFILE_STREAMS; i++) { struct file_struct *filep = &streamlist->sl_streams[i]; - if (filep->fs_filedes >= 0) + if (filep->fs_fd >= 0) { #if CONFIG_STDIO_BUFFER_SIZE > 0 sdbg(" fd=%d nbytes=%d\n", - filep->fs_filedes, + filep->fs_fd, filep->fs_bufpos - filep->fs_bufstart); #else - sdbg(" fd=%d\n", filep->fs_filedes); + sdbg(" fd=%d\n", filep->fs_fd); #endif } } diff --git a/arch/sim/src/up_devconsole.c b/arch/sim/src/up_devconsole.c index bd2be0f10f1..07c4267191f 100644 --- a/arch/sim/src/up_devconsole.c +++ b/arch/sim/src/up_devconsole.c @@ -1,7 +1,7 @@ /**************************************************************************** - * up_devconsole.c + * arch/sim/src/up_devconsole.c * - * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -78,12 +78,12 @@ static const struct file_operations devconsole_fops = * Private Functions ****************************************************************************/ -static ssize_t devconsole_read(struct file *filp, char *buffer, size_t len) +static ssize_t devconsole_read(struct file *filep, char *buffer, size_t len) { return up_hostread(buffer, len); } -static ssize_t devconsole_write(struct file *filp, const char *buffer, size_t len) +static ssize_t devconsole_write(struct file *filep, const char *buffer, size_t len) { return up_hostwrite(buffer, len); } diff --git a/arch/x86/src/common/up_exit.c b/arch/x86/src/common/up_exit.c index 9b0c0cbe101..424a89f4f19 100644 --- a/arch/x86/src/common/up_exit.c +++ b/arch/x86/src/common/up_exit.c @@ -104,14 +104,14 @@ static void _up_dumponexit(FAR struct tcb_s *tcb, FAR void *arg) for (i = 0; i < CONFIG_NFILE_STREAMS; i++) { struct file_struct *filep = &streamlist->sl_streams[i]; - if (filep->fs_filedes >= 0) + if (filep->fs_fd >= 0) { #if CONFIG_STDIO_BUFFER_SIZE > 0 sdbg(" fd=%d nbytes=%d\n", - filep->fs_filedes, + filep->fs_fd, filep->fs_bufpos - filep->fs_bufstart); #else - sdbg(" fd=%d\n", filep->fs_filedes); + sdbg(" fd=%d\n", filep->fs_fd); #endif } } diff --git a/arch/z16/src/common/up_exit.c b/arch/z16/src/common/up_exit.c index e4c6dcf9c8f..6f118fe2490 100644 --- a/arch/z16/src/common/up_exit.c +++ b/arch/z16/src/common/up_exit.c @@ -106,14 +106,14 @@ static void _up_dumponexit(FAR struct tcb_s *tcb, FAR void *arg) for (i = 0; i < CONFIG_NFILE_STREAMS; i++) { struct file_struct *filep = &streamlist->sl_streams[i]; - if (filep->fs_filedes >= 0) + if (filep->fs_fd >= 0) { #if CONFIG_STDIO_BUFFER_SIZE > 0 lldbg(" fd=%d nbytes=%d\n", - filep->fs_filedes, + filep->fs_fd, filep->fs_bufpos - filep->fs_bufstart); #else - lldbg(" fd=%d\n", filep->fs_filedes); + lldbg(" fd=%d\n", filep->fs_fd); #endif } } diff --git a/arch/z80/src/common/up_exit.c b/arch/z80/src/common/up_exit.c index aa578f29e52..d38e4fb030e 100644 --- a/arch/z80/src/common/up_exit.c +++ b/arch/z80/src/common/up_exit.c @@ -107,14 +107,14 @@ static void _up_dumponexit(FAR struct tcb_s *tcb, FAR void *arg) for (i = 0; i < CONFIG_NFILE_STREAMS; i++) { struct file_struct *filep = &streamlist->sl_streams[i]; - if (filep->fs_filedes >= 0) + if (filep->fs_fd >= 0) { #if CONFIG_STDIO_BUFFER_SIZE > 0 lldbg(" fd=%d nbytes=%d\n", - filep->fs_filedes, + filep->fs_fd, filep->fs_bufpos - filep->fs_bufstart); #else - lldbg(" fd=%d\n", filep->fs_filedes); + lldbg(" fd=%d\n", filep->fs_fd); #endif } } diff --git a/configs/pcblogic-pic32mx/src/pic32mx_lcd1602.c b/configs/pcblogic-pic32mx/src/pic32mx_lcd1602.c index d12c6bdab87..c03191b02cf 100644 --- a/configs/pcblogic-pic32mx/src/pic32mx_lcd1602.c +++ b/configs/pcblogic-pic32mx/src/pic32mx_lcd1602.c @@ -198,9 +198,9 @@ static void lcd_action(enum slcdcode_e code, uint8_t count); static ssize_t lcd_read(FAR struct file *, FAR char *, size_t); static ssize_t lcd_write(FAR struct file *, FAR const char *, size_t); -static int lcd_ioctl(FAR struct file *filp, int cmd, unsigned long arg); +static int lcd_ioctl(FAR struct file *filep, int cmd, unsigned long arg); #ifndef CONFIG_DISABLE_POLL -static int lcd_poll(FAR struct file *filp, FAR struct pollfd *fds, bool setup); +static int lcd_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup); #endif /**************************************************************************** @@ -662,14 +662,14 @@ static void lcd_action(enum slcdcode_e code, uint8_t count) * Name: lcd_read ****************************************************************************/ -static ssize_t lcd_read(FAR struct file *filp, FAR char *buffer, size_t len) +static ssize_t lcd_read(FAR struct file *filep, FAR char *buffer, size_t len) { uint8_t row; uint8_t column; int nread; /* Try to read the entire display. Notice that the seek offset - * (filp->f_pos) is ignored. It probably should be taken into account + * (filep->f_pos) is ignored. It probably should be taken into account * and also updated after each read and write. */ @@ -696,7 +696,7 @@ static ssize_t lcd_read(FAR struct file *filp, FAR char *buffer, size_t len) * Name: lcd_write ****************************************************************************/ -static ssize_t lcd_write(FAR struct file *filp, FAR const char *buffer, +static ssize_t lcd_write(FAR struct file *filep, FAR const char *buffer, size_t len) { struct lcd_instream_s instream; @@ -781,7 +781,7 @@ static ssize_t lcd_write(FAR struct file *filp, FAR const char *buffer, * Name: lcd_ioctl ****************************************************************************/ -static int lcd_ioctl(FAR struct file *filp, int cmd, unsigned long arg) +static int lcd_ioctl(FAR struct file *filep, int cmd, unsigned long arg) { switch (cmd) { @@ -851,7 +851,7 @@ static int lcd_ioctl(FAR struct file *filp, int cmd, unsigned long arg) ****************************************************************************/ #ifndef CONFIG_DISABLE_POLL -static int lcd_poll(FAR struct file *filp, FAR struct pollfd *fds, +static int lcd_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup) { if (setup) diff --git a/configs/sam4l-xplained/src/sam_slcd.c b/configs/sam4l-xplained/src/sam_slcd.c index 898c7e88383..d8ed61bac09 100644 --- a/configs/sam4l-xplained/src/sam_slcd.c +++ b/configs/sam4l-xplained/src/sam_slcd.c @@ -321,9 +321,9 @@ static void slcd_action(enum slcdcode_e code, uint8_t count); static ssize_t slcd_read(FAR struct file *, FAR char *, size_t); static ssize_t slcd_write(FAR struct file *, FAR const char *, size_t); -static int slcd_ioctl(FAR struct file *filp, int cmd, unsigned long arg); +static int slcd_ioctl(FAR struct file *filep, int cmd, unsigned long arg); #ifndef CONFIG_DISABLE_POLL -static int slcd_poll(FAR struct file *filp, FAR struct pollfd *fds, bool setup); +static int slcd_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup); #endif /**************************************************************************** @@ -856,13 +856,13 @@ static void slcd_action(enum slcdcode_e code, uint8_t count) * Name: slcd_read ****************************************************************************/ -static ssize_t slcd_read(FAR struct file *filp, FAR char *buffer, size_t len) +static ssize_t slcd_read(FAR struct file *filep, FAR char *buffer, size_t len) { int ret = 0; int i; /* Try to read the entire display. Notice that the seek offset - * (filp->f_pos) is ignored. It probably should be taken into account + * (filep->f_pos) is ignored. It probably should be taken into account * and also updated after each read and write. */ @@ -892,7 +892,7 @@ static ssize_t slcd_read(FAR struct file *filp, FAR char *buffer, size_t len) * Name: slcd_write ****************************************************************************/ -static ssize_t slcd_write(FAR struct file *filp, +static ssize_t slcd_write(FAR struct file *filep, FAR const char *buffer, size_t len) { struct slcd_instream_s instream; @@ -1006,7 +1006,7 @@ static ssize_t slcd_write(FAR struct file *filp, * Name: slcd_poll ****************************************************************************/ -static int slcd_ioctl(FAR struct file *filp, int cmd, unsigned long arg) +static int slcd_ioctl(FAR struct file *filep, int cmd, unsigned long arg) { switch (cmd) { @@ -1156,7 +1156,7 @@ static int slcd_ioctl(FAR struct file *filp, int cmd, unsigned long arg) ****************************************************************************/ #ifndef CONFIG_DISABLE_POLL -static int slcd_poll(FAR struct file *filp, FAR struct pollfd *fds, +static int slcd_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup) { if (setup) diff --git a/configs/stm32ldiscovery/src/stm32_lcd.c b/configs/stm32ldiscovery/src/stm32_lcd.c index c7483695979..1c14bf595d0 100644 --- a/configs/stm32ldiscovery/src/stm32_lcd.c +++ b/configs/stm32ldiscovery/src/stm32_lcd.c @@ -323,9 +323,9 @@ static void slcd_action(enum slcdcode_e code, uint8_t count); static ssize_t slcd_read(FAR struct file *, FAR char *, size_t); static ssize_t slcd_write(FAR struct file *, FAR const char *, size_t); -static int slcd_ioctl(FAR struct file *filp, int cmd, unsigned long arg); +static int slcd_ioctl(FAR struct file *filep, int cmd, unsigned long arg); #ifndef CONFIG_DISABLE_POLL -static int slcd_poll(FAR struct file *filp, FAR struct pollfd *fds, bool setup); +static int slcd_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup); #endif /**************************************************************************** @@ -1085,13 +1085,13 @@ static void slcd_action(enum slcdcode_e code, uint8_t count) * Name: slcd_read ****************************************************************************/ -static ssize_t slcd_read(FAR struct file *filp, FAR char *buffer, size_t len) +static ssize_t slcd_read(FAR struct file *filep, FAR char *buffer, size_t len) { int ret = 0; int i; /* Try to read the entire display. Notice that the seek offset - * (filp->f_pos) is ignored. It probably should be taken into account + * (filep->f_pos) is ignored. It probably should be taken into account * and also updated after each read and write. */ @@ -1127,7 +1127,7 @@ static ssize_t slcd_read(FAR struct file *filp, FAR char *buffer, size_t len) * Name: slcd_write ****************************************************************************/ -static ssize_t slcd_write(FAR struct file *filp, +static ssize_t slcd_write(FAR struct file *filep, FAR const char *buffer, size_t len) { struct slcd_instream_s instream; @@ -1314,7 +1314,7 @@ static ssize_t slcd_write(FAR struct file *filp, * Name: slcd_poll ****************************************************************************/ -static int slcd_ioctl(FAR struct file *filp, int cmd, unsigned long arg) +static int slcd_ioctl(FAR struct file *filep, int cmd, unsigned long arg) { switch (cmd) { @@ -1457,7 +1457,7 @@ static int slcd_ioctl(FAR struct file *filp, int cmd, unsigned long arg) ****************************************************************************/ #ifndef CONFIG_DISABLE_POLL -static int slcd_poll(FAR struct file *filp, FAR struct pollfd *fds, +static int slcd_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup) { if (setup) diff --git a/configs/sure-pic32mx/src/pic32mx_lcd1602.c b/configs/sure-pic32mx/src/pic32mx_lcd1602.c index d12838b7d80..9a881647e59 100644 --- a/configs/sure-pic32mx/src/pic32mx_lcd1602.c +++ b/configs/sure-pic32mx/src/pic32mx_lcd1602.c @@ -207,9 +207,9 @@ static void lcd_action(enum slcdcode_e code, uint8_t count); static ssize_t lcd_read(FAR struct file *, FAR char *, size_t); static ssize_t lcd_write(FAR struct file *, FAR const char *, size_t); -static int lcd_ioctl(FAR struct file *filp, int cmd, unsigned long arg); +static int lcd_ioctl(FAR struct file *filep, int cmd, unsigned long arg); #ifndef CONFIG_DISABLE_POLL -static int lcd_poll(FAR struct file *filp, FAR struct pollfd *fds, bool setup); +static int lcd_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup); #endif /**************************************************************************** @@ -817,14 +817,14 @@ static void lcd_action(enum slcdcode_e code, uint8_t count) * Name: lcd_read ****************************************************************************/ -static ssize_t lcd_read(FAR struct file *filp, FAR char *buffer, size_t len) +static ssize_t lcd_read(FAR struct file *filep, FAR char *buffer, size_t len) { uint8_t row; uint8_t column; int nread; /* Try to read the entire display. Notice that the seek offset - * (filp->f_pos) is ignored. It probably should be taken into account + * (filep->f_pos) is ignored. It probably should be taken into account * and also updated after each read and write. */ @@ -851,7 +851,7 @@ static ssize_t lcd_read(FAR struct file *filp, FAR char *buffer, size_t len) * Name: lcd_write ****************************************************************************/ -static ssize_t lcd_write(FAR struct file *filp, FAR const char *buffer, +static ssize_t lcd_write(FAR struct file *filep, FAR const char *buffer, size_t len) { struct lcd_instream_s instream; @@ -936,7 +936,7 @@ static ssize_t lcd_write(FAR struct file *filp, FAR const char *buffer, * Name: lcd_ioctl ****************************************************************************/ -static int lcd_ioctl(FAR struct file *filp, int cmd, unsigned long arg) +static int lcd_ioctl(FAR struct file *filep, int cmd, unsigned long arg) { switch (cmd) { @@ -1041,7 +1041,7 @@ static int lcd_ioctl(FAR struct file *filp, int cmd, unsigned long arg) ****************************************************************************/ #ifndef CONFIG_DISABLE_POLL -static int lcd_poll(FAR struct file *filp, FAR struct pollfd *fds, +static int lcd_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup) { if (setup) diff --git a/configs/vsn/src/sif.c b/configs/vsn/src/sif.c index 2dacc6f69e6..6fa0be5a202 100644 --- a/configs/vsn/src/sif.c +++ b/configs/vsn/src/sif.c @@ -475,7 +475,7 @@ int devsif_close(FAR struct file *filep) } -static ssize_t devsif_read(FAR struct file *filp, FAR char *buffer, size_t len) +static ssize_t devsif_read(FAR struct file *filep, FAR char *buffer, size_t len) { sif_sem_wait(); memset(buffer, 0, len); @@ -484,7 +484,7 @@ static ssize_t devsif_read(FAR struct file *filp, FAR char *buffer, size_t len) } -static ssize_t devsif_write(FAR struct file *filp, FAR const char *buffer, size_t len) +static ssize_t devsif_write(FAR struct file *filep, FAR const char *buffer, size_t len) { sif_sem_wait(); printf("getpid: %d\n", getpid() ); @@ -494,7 +494,7 @@ static ssize_t devsif_write(FAR struct file *filp, FAR const char *buffer, size_ #ifndef CONFIG_DISABLE_POLL -static int devsif_poll(FAR struct file *filp, FAR struct pollfd *fds, +static int devsif_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup) { if (setup) { diff --git a/drivers/bch/bchdev_driver.c b/drivers/bch/bchdev_driver.c index 262a0af4693..597710d99dc 100644 --- a/drivers/bch/bchdev_driver.c +++ b/drivers/bch/bchdev_driver.c @@ -68,11 +68,14 @@ * Private Function Prototypes ****************************************************************************/ -static int bch_open(FAR struct file *filp); -static int bch_close(FAR struct file *filp); -static ssize_t bch_read(FAR struct file *, FAR char *, size_t); -static ssize_t bch_write(FAR struct file *, FAR const char *, size_t); -static int bch_ioctl(FAR struct file *filp, int cmd, unsigned long arg); +static int bch_open(FAR struct file *filep); +static int bch_close(FAR struct file *filep); +static ssize_t bch_read(FAR struct file *filep, FAR char *buffer, + size_t buflen); +static ssize_t bch_write(FAR struct file *filep, FAR const char *buffer, + size_t buflen); +static int bch_ioctl(FAR struct file *filep, int cmd, + unsigned long arg); /**************************************************************************** * Public Data @@ -102,9 +105,9 @@ const struct file_operations bch_fops = * ****************************************************************************/ -static int bch_open(FAR struct file *filp) +static int bch_open(FAR struct file *filep) { - FAR struct inode *inode = filp->f_inode; + FAR struct inode *inode = filep->f_inode; FAR struct bchlib_s *bch; DEBUGASSERT(inode && inode->i_private); @@ -133,9 +136,9 @@ static int bch_open(FAR struct file *filp) * ****************************************************************************/ -static int bch_close(FAR struct file *filp) +static int bch_close(FAR struct file *filep) { - FAR struct inode *inode = filp->f_inode; + FAR struct inode *inode = filep->f_inode; FAR struct bchlib_s *bch; int ret = OK; @@ -168,9 +171,9 @@ static int bch_close(FAR struct file *filp) * Name:bch_read ****************************************************************************/ -static ssize_t bch_read(FAR struct file *filp, FAR char *buffer, size_t len) +static ssize_t bch_read(FAR struct file *filep, FAR char *buffer, size_t len) { - FAR struct inode *inode = filp->f_inode; + FAR struct inode *inode = filep->f_inode; FAR struct bchlib_s *bch; int ret; @@ -178,10 +181,10 @@ static ssize_t bch_read(FAR struct file *filp, FAR char *buffer, size_t len) bch = (FAR struct bchlib_s *)inode->i_private; bchlib_semtake(bch); - ret = bchlib_read(bch, buffer, filp->f_pos, len); + ret = bchlib_read(bch, buffer, filep->f_pos, len); if (ret > 0) { - filp->f_pos += len; + filep->f_pos += len; } bchlib_semgive(bch); return ret; @@ -191,9 +194,9 @@ static ssize_t bch_read(FAR struct file *filp, FAR char *buffer, size_t len) * Name:bch_write ****************************************************************************/ -static ssize_t bch_write(FAR struct file *filp, FAR const char *buffer, size_t len) +static ssize_t bch_write(FAR struct file *filep, FAR const char *buffer, size_t len) { - FAR struct inode *inode = filp->f_inode; + FAR struct inode *inode = filep->f_inode; FAR struct bchlib_s *bch; int ret = -EACCES; @@ -203,10 +206,10 @@ static ssize_t bch_write(FAR struct file *filp, FAR const char *buffer, size_t l if (!bch->readonly) { bchlib_semtake(bch); - ret = bchlib_write(bch, buffer, filp->f_pos, len); + ret = bchlib_write(bch, buffer, filep->f_pos, len); if (ret > 0) { - filp->f_pos += len; + filep->f_pos += len; } bchlib_semgive(bch); } @@ -221,9 +224,9 @@ static ssize_t bch_write(FAR struct file *filp, FAR const char *buffer, size_t l * ****************************************************************************/ -static int bch_ioctl(FAR struct file *filp, int cmd, unsigned long arg) +static int bch_ioctl(FAR struct file *filep, int cmd, unsigned long arg) { - FAR struct inode *inode = filp->f_inode; + FAR struct inode *inode = filep->f_inode; FAR struct bchlib_s *bch; int ret = -ENOTTY; diff --git a/drivers/dev_null.c b/drivers/dev_null.c index c70370e1e52..1a405d7cfc3 100644 --- a/drivers/dev_null.c +++ b/drivers/dev_null.c @@ -1,7 +1,7 @@ /**************************************************************************** * drivers/dev_null.c * - * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -53,7 +53,7 @@ static ssize_t devnull_read(FAR struct file *, FAR char *, size_t); static ssize_t devnull_write(FAR struct file *, FAR const char *, size_t); #ifndef CONFIG_DISABLE_POLL -static int devnull_poll(FAR struct file *filp, FAR struct pollfd *fds, +static int devnull_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup); #endif @@ -82,7 +82,7 @@ static const struct file_operations devnull_fops = * Name: devnull_read ****************************************************************************/ -static ssize_t devnull_read(FAR struct file *filp, FAR char *buffer, size_t len) +static ssize_t devnull_read(FAR struct file *filep, FAR char *buffer, size_t len) { return 0; /* Return EOF */ } @@ -91,7 +91,7 @@ static ssize_t devnull_read(FAR struct file *filp, FAR char *buffer, size_t len) * Name: devnull_write ****************************************************************************/ -static ssize_t devnull_write(FAR struct file *filp, FAR const char *buffer, size_t len) +static ssize_t devnull_write(FAR struct file *filep, FAR const char *buffer, size_t len) { return len; /* Say that everything was written */ } @@ -101,7 +101,7 @@ static ssize_t devnull_write(FAR struct file *filp, FAR const char *buffer, size ****************************************************************************/ #ifndef CONFIG_DISABLE_POLL -static int devnull_poll(FAR struct file *filp, FAR struct pollfd *fds, +static int devnull_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup) { if (setup) diff --git a/drivers/dev_zero.c b/drivers/dev_zero.c index 5435f80ea28..a1374101ad4 100644 --- a/drivers/dev_zero.c +++ b/drivers/dev_zero.c @@ -1,7 +1,7 @@ /**************************************************************************** - * drivers/dev_null.c + * drivers/dev_zero.c * - * Copyright (C) 2008-2009, 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009, 2012-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -53,7 +53,7 @@ static ssize_t devzero_read(FAR struct file *, FAR char *, size_t); static ssize_t devzero_write(FAR struct file *, FAR const char *, size_t); #ifndef CONFIG_DISABLE_POLL -static int devzero_poll(FAR struct file *filp, FAR struct pollfd *fds, +static int devzero_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup); #endif @@ -82,7 +82,8 @@ static const struct file_operations devzero_fops = * Name: devzero_read ****************************************************************************/ -static ssize_t devzero_read(FAR struct file *filp, FAR char *buffer, size_t len) +static ssize_t devzero_read(FAR struct file *filep, FAR char *buffer, + size_t len) { memset(buffer, 0, len); return len; @@ -92,7 +93,8 @@ static ssize_t devzero_read(FAR struct file *filp, FAR char *buffer, size_t len) * Name: devzero_write ****************************************************************************/ -static ssize_t devzero_write(FAR struct file *filp, FAR const char *buffer, size_t len) +static ssize_t devzero_write(FAR struct file *filep, FAR const char *buffer, + size_t len) { return len; } @@ -102,7 +104,7 @@ static ssize_t devzero_write(FAR struct file *filp, FAR const char *buffer, size ****************************************************************************/ #ifndef CONFIG_DISABLE_POLL -static int devzero_poll(FAR struct file *filp, FAR struct pollfd *fds, +static int devzero_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup) { if (setup) diff --git a/drivers/pipes/pipe.c b/drivers/pipes/pipe.c index 20c160475b4..ce4a7dbe189 100644 --- a/drivers/pipes/pipe.c +++ b/drivers/pipes/pipe.c @@ -172,11 +172,11 @@ static int pipe_close(FAR struct file *filep) * * Description: * pipe() creates a pair of file descriptors, pointing to a pipe inode, and - * places them in the array pointed to by 'filedes'. filedes[0] is for reading, - * filedes[1] is for writing. + * places them in the array pointed to by 'fd'. fd[0] is for reading, + * fd[1] is for writing. * * Inputs: - * filedes[2] - The user provided array in which to catch the pipe file + * fd[2] - The user provided array in which to catch the pipe file * descriptors * * Return: @@ -185,7 +185,7 @@ static int pipe_close(FAR struct file *filep) * ****************************************************************************/ -int pipe(int filedes[2]) +int pipe(int fd[2]) { struct pipe_dev_s *dev = NULL; char devname[16]; @@ -249,29 +249,29 @@ int pipe(int filedes[2]) } (void)sem_post(&g_pipesem); - + /* Get a write file descriptor */ - filedes[1] = open(devname, O_WRONLY); - if (filedes[1] < 0) + fd[1] = open(devname, O_WRONLY); + if (fd[1] < 0) { - err = -filedes[1]; + err = -fd[1]; goto errout_with_driver; } /* Get a read file descriptor */ - filedes[0] = open(devname, O_RDONLY); - if (filedes[0] < 0) + fd[0] = open(devname, O_RDONLY); + if (fd[0] < 0) { - err = -filedes[0]; + err = -fd[0]; goto errout_with_wrfd; } return OK; errout_with_wrfd: - close(filedes[1]); + close(fd[1]); errout_with_driver: unregister_driver(devname); errout_with_dev: diff --git a/fs/fs_dup.c b/fs/fs_dup.c index 890da039bcc..1cb1b167441 100644 --- a/fs/fs_dup.c +++ b/fs/fs_dup.c @@ -66,7 +66,7 @@ * ****************************************************************************/ -int dup(int fildes) +int dup(int fd) { int ret = OK; @@ -74,12 +74,12 @@ int dup(int fildes) * descriptor. */ #if CONFIG_NFILE_DESCRIPTORS > 0 - if ((unsigned int)fildes < CONFIG_NFILE_DESCRIPTORS) + if ((unsigned int)fd < CONFIG_NFILE_DESCRIPTORS) { /* Its a valid file descriptor.. dup the file descriptor using any * other file descriptor*/ - ret = file_dup(fildes, 0); + ret = file_dup(fd, 0); } else #endif @@ -87,11 +87,11 @@ int dup(int fildes) /* Not a vailid file descriptor. Did we get a valid socket descriptor? */ #if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0 - if ((unsigned int)fildes < (CONFIG_NFILE_DESCRIPTORS+CONFIG_NSOCKET_DESCRIPTORS)) + if ((unsigned int)fd < (CONFIG_NFILE_DESCRIPTORS+CONFIG_NSOCKET_DESCRIPTORS)) { /* Yes.. dup the socket descriptor */ - ret = net_dup(fildes, CONFIG_NFILE_DESCRIPTORS); + ret = net_dup(fd, CONFIG_NFILE_DESCRIPTORS); } else #endif diff --git a/fs/fs_dup2.c b/fs/fs_dup2.c index 45ff2bb738e..14171fe473c 100644 --- a/fs/fs_dup2.c +++ b/fs/fs_dup2.c @@ -1,7 +1,7 @@ /**************************************************************************** * fs/fs_dup2.c * - * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -73,21 +73,21 @@ * ****************************************************************************/ -int dup2(int fildes1, int fildes2) +int dup2(int fd1, int fd2) { /* Check the range of the descriptor to see if we got a file or a socket * descriptor. */ - if ((unsigned int)fildes1 >= CONFIG_NFILE_DESCRIPTORS) + if ((unsigned int)fd1 >= CONFIG_NFILE_DESCRIPTORS) { /* Not a valid file descriptor. Did we get a valid socket descriptor? */ - if ((unsigned int)fildes1 < (CONFIG_NFILE_DESCRIPTORS+CONFIG_NSOCKET_DESCRIPTORS)) + if ((unsigned int)fd1 < (CONFIG_NFILE_DESCRIPTORS+CONFIG_NSOCKET_DESCRIPTORS)) { /* Yes.. dup the socket descriptor */ - return net_dup2(fildes1, fildes2); + return net_dup2(fd1, fd2); } else { @@ -101,7 +101,7 @@ int dup2(int fildes1, int fildes2) { /* Its a valid file descriptor.. dup the file descriptor */ - return file_dup2(fildes1, fildes2); + return file_dup2(fd1, fd2); } } diff --git a/fs/fs_fdopen.c b/fs/fs_fdopen.c index 58ea043c5e2..6544ee2b824 100644 --- a/fs/fs_fdopen.c +++ b/fs/fs_fdopen.c @@ -210,7 +210,7 @@ FAR struct file_struct *fs_fdopen(int fd, int oflags, FAR struct tcb_s *tcb) for (i = 0 ; i < CONFIG_NFILE_STREAMS; i++) { stream = &slist->sl_streams[i]; - if (stream->fs_filedes < 0) + if (stream->fs_fd < 0) { /* Zero the structure */ @@ -245,7 +245,7 @@ FAR struct file_struct *fs_fdopen(int fd, int oflags, FAR struct tcb_s *tcb) * file descriptor locks this stream. */ - stream->fs_filedes = fd; + stream->fs_fd = fd; stream->fs_oflags = (uint16_t)oflags; sem_post(&slist->sl_sem); diff --git a/fs/fs_filedup.c b/fs/fs_filedup.c index dcc229ab382..53cdc1b0aea 100644 --- a/fs/fs_filedup.c +++ b/fs/fs_filedup.c @@ -1,7 +1,7 @@ /**************************************************************************** * fs/fs_filedup.c * - * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -77,19 +77,19 @@ * ****************************************************************************/ -int file_dup(int fildes, int minfd) +int file_dup(int fd, int minfd) { FAR struct filelist *list; - int fildes2; + int fd2; /* Get the thread-specific file list */ list = sched_getfiles(); DEBUGASSERT(list); - /* Verify that fildes is a valid, open file descriptor */ + /* Verify that fd is a valid, open file descriptor */ - if (!DUP_ISOPEN(fildes, list)) + if (!DUP_ISOPEN(fd, list)) { set_errno(EBADF); return ERROR; @@ -97,22 +97,22 @@ int file_dup(int fildes, int minfd) /* Increment the reference count on the contained inode */ - inode_addref(list->fl_files[fildes].f_inode); + inode_addref(list->fl_files[fd].f_inode); /* Then allocate a new file descriptor for the inode */ - fildes2 = files_allocate(list->fl_files[fildes].f_inode, - list->fl_files[fildes].f_oflags, - list->fl_files[fildes].f_pos, - minfd); - if (fildes2 < 0) + fd2 = files_allocate(list->fl_files[fd].f_inode, + list->fl_files[fd].f_oflags, + list->fl_files[fd].f_pos, + minfd); + if (fd2 < 0) { set_errno(EMFILE); - inode_release(list->fl_files[fildes].f_inode); + inode_release(list->fl_files[fd].f_inode); return ERROR; } - return fildes2; + return fd2; } #endif /* CONFIG_NFILE_DESCRIPTORS > 0 */ diff --git a/fs/fs_filedup2.c b/fs/fs_filedup2.c index d064aa08be7..7b94cb569bc 100644 --- a/fs/fs_filedup2.c +++ b/fs/fs_filedup2.c @@ -1,7 +1,7 @@ /**************************************************************************** * fs/fs_filedup2.c * - * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -75,9 +75,9 @@ ****************************************************************************/ #if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0 -int file_dup2(int fildes1, int fildes2) +int file_dup2(int fd1, int fd2) #else -int dup2(int fildes1, int fildes2) +int dup2(int fd1, int fd2) #endif { FAR struct filelist *list; @@ -91,9 +91,9 @@ int dup2(int fildes1, int fildes2) return ERROR; } - /* Verify that fildes is a valid, open file descriptor */ + /* Verify that fd is a valid, open file descriptor */ - if (!DUP_ISOPEN(fildes1, list)) + if (!DUP_ISOPEN(fd1, list)) { set_errno(EBADF); return ERROR; @@ -101,20 +101,20 @@ int dup2(int fildes1, int fildes2) /* Handle a special case */ - if (fildes1 == fildes2) + if (fd1 == fd2) { - return fildes1; + return fd1; } - /* Verify fildes2 */ + /* Verify fd2 */ - if ((unsigned int)fildes2 >= CONFIG_NFILE_DESCRIPTORS) + if ((unsigned int)fd2 >= CONFIG_NFILE_DESCRIPTORS) { set_errno(EBADF); return ERROR; } - return files_dup(&list->fl_files[fildes1], &list->fl_files[fildes2]); + return files_dup(&list->fl_files[fd1], &list->fl_files[fd2]); } #endif /* CONFIG_NFILE_DESCRIPTORS > 0 */ diff --git a/fs/fs_files.c b/fs/fs_files.c index 739947a7d65..e20e0e9ef4f 100644 --- a/fs/fs_files.c +++ b/fs/fs_files.c @@ -344,7 +344,7 @@ int files_allocate(FAR struct inode *inode, int oflags, off_t pos, int minfd) * ****************************************************************************/ -int files_close(int filedes) +int files_close(int fd) { FAR struct filelist *list; int ret; @@ -356,7 +356,7 @@ int files_close(int filedes) /* If the file was properly opened, there should be an inode assigned */ - if (filedes < 0 || filedes >= CONFIG_NFILE_DESCRIPTORS || !list->fl_files[filedes].f_inode) + if (fd < 0 || fd >= CONFIG_NFILE_DESCRIPTORS || !list->fl_files[fd].f_inode) { return -EBADF; } @@ -364,7 +364,7 @@ int files_close(int filedes) /* Perform the protected close operation */ _files_semtake(list); - ret = _files_close(&list->fl_files[filedes]); + ret = _files_close(&list->fl_files[fd]); _files_semgive(list); return ret; } @@ -378,20 +378,19 @@ int files_close(int filedes) * ****************************************************************************/ -void files_release(int filedes) +void files_release(int fd) { FAR struct filelist *list; list = sched_getfiles(); DEBUGASSERT(list); - if (filedes >=0 && filedes < CONFIG_NFILE_DESCRIPTORS) + if (fd >=0 && fd < CONFIG_NFILE_DESCRIPTORS) { _files_semtake(list); - list->fl_files[filedes].f_oflags = 0; - list->fl_files[filedes].f_pos = 0; - list->fl_files[filedes].f_inode = NULL; + list->fl_files[fd].f_oflags = 0; + list->fl_files[fd].f_pos = 0; + list->fl_files[fd].f_inode = NULL; _files_semgive(list); } } - diff --git a/fs/fs_internal.h b/fs/fs_internal.h index 786c683dcba..648f0270411 100644 --- a/fs/fs_internal.h +++ b/fs/fs_internal.h @@ -119,7 +119,7 @@ extern "C" { * ****************************************************************************/ -EXTERN void inode_semtake(void); +void inode_semtake(void); /**************************************************************************** * Name: inode_semgive @@ -129,7 +129,7 @@ EXTERN void inode_semtake(void); * ****************************************************************************/ -EXTERN void inode_semgive(void); +void inode_semgive(void); /**************************************************************************** * Name: inode_search @@ -143,10 +143,10 @@ EXTERN void inode_semgive(void); * ****************************************************************************/ -EXTERN FAR struct inode *inode_search(FAR const char **path, - FAR struct inode **peer, - FAR struct inode **parent, - FAR const char **relpath); +FAR struct inode *inode_search(FAR const char **path, + FAR struct inode **peer, + FAR struct inode **parent, + FAR const char **relpath); /**************************************************************************** * Name: inode_free @@ -156,7 +156,7 @@ EXTERN FAR struct inode *inode_search(FAR const char **path, * ****************************************************************************/ -EXTERN void inode_free(FAR struct inode *node); +void inode_free(FAR struct inode *node); /**************************************************************************** * Name: inode_nextname @@ -167,7 +167,7 @@ EXTERN void inode_free(FAR struct inode *node); * ****************************************************************************/ -EXTERN const char *inode_nextname(FAR const char *name); +const char *inode_nextname(FAR const char *name); /* fs_inodereserver.c *******************************************************/ /**************************************************************************** @@ -192,7 +192,7 @@ EXTERN const char *inode_nextname(FAR const char *name); * ****************************************************************************/ -EXTERN int inode_reserve(FAR const char *path, FAR struct inode **inode); +int inode_reserve(FAR const char *path, FAR struct inode **inode); /* fs_inoderemove.c *********************************************************/ /**************************************************************************** @@ -205,7 +205,7 @@ EXTERN int inode_reserve(FAR const char *path, FAR struct inode **inode); * ****************************************************************************/ -EXTERN int inode_remove(FAR const char *path); +int inode_remove(FAR const char *path); /* fs_inodefind.c ***********************************************************/ /**************************************************************************** @@ -217,15 +217,15 @@ EXTERN int inode_remove(FAR const char *path); * ****************************************************************************/ -EXTERN FAR struct inode *inode_find(FAR const char *path, const char **relpath); +FAR struct inode *inode_find(FAR const char *path, const char **relpath); /* fs_inodeaddref.c *********************************************************/ -EXTERN void inode_addref(FAR struct inode *inode); +void inode_addref(FAR struct inode *inode); /* fs_inoderelease.c ********************************************************/ -EXTERN void inode_release(FAR struct inode *inode); +void inode_release(FAR struct inode *inode); /* fs_foreachinode.c ********************************************************/ /**************************************************************************** @@ -244,7 +244,7 @@ EXTERN void inode_release(FAR struct inode *inode); * ****************************************************************************/ -EXTERN int foreach_inode(foreach_inode_t handler, FAR void *arg); +int foreach_inode(foreach_inode_t handler, FAR void *arg); /* fs_files.c ***************************************************************/ /**************************************************************************** @@ -255,7 +255,7 @@ EXTERN int foreach_inode(foreach_inode_t handler, FAR void *arg); * ****************************************************************************/ -EXTERN void weak_function files_initialize(void); +void weak_function files_initialize(void); /**************************************************************************** * Name: files_allocate @@ -266,7 +266,7 @@ EXTERN void weak_function files_initialize(void); * ****************************************************************************/ -EXTERN int files_allocate(FAR struct inode *inode, int oflags, off_t pos, int minfd); +int files_allocate(FAR struct inode *inode, int oflags, off_t pos, int minfd); /**************************************************************************** * Name: files_close @@ -279,7 +279,7 @@ EXTERN int files_allocate(FAR struct inode *inode, int oflags, off_t pos, int m * ****************************************************************************/ -EXTERN int files_close(int filedes); +int files_close(int fd); /**************************************************************************** * Name: files_release @@ -290,7 +290,7 @@ EXTERN int files_close(int filedes); * ****************************************************************************/ -EXTERN void files_release(int filedes); +void files_release(int fd); /* fs_findblockdriver.c *****************************************************/ /**************************************************************************** @@ -316,8 +316,8 @@ EXTERN void files_release(int filedes); * ****************************************************************************/ -EXTERN int find_blockdriver(FAR const char *pathname, int mountflags, - FAR struct inode **ppinode); +int find_blockdriver(FAR const char *pathname, int mountflags, + FAR struct inode **ppinode); #undef EXTERN #if defined(__cplusplus) diff --git a/fs/fs_lseek.c b/fs/fs_lseek.c index d2a2a8ca79e..c594610529e 100644 --- a/fs/fs_lseek.c +++ b/fs/fs_lseek.c @@ -138,7 +138,7 @@ errout: * * Description: * The lseek() function repositions the offset of the open file associated - * with the file descriptor fildes to the argument 'offset' according to the + * with the file descriptor fd to the argument 'offset' according to the * directive 'whence' as follows: * * SEEK_SET @@ -161,12 +161,12 @@ errout: * Return: * The resulting offset on success. -1 on failure withi errno set properly: * - * EBADF fildes is not an open file descriptor. + * EBADF fd is not an open file descriptor. * EINVAL whence is not one of SEEK_SET, SEEK_CUR, SEEK_END; or the * resulting file offset would be negative, or beyond the end of a * seekable device. * EOVERFLOW The resulting file offset cannot be represented in an off_t. - * ESPIPE fildes is associated with a pipe, socket, or FIFO. + * ESPIPE fd is associated with a pipe, socket, or FIFO. * ****************************************************************************/ diff --git a/include/nuttx/fs/fs.h b/include/nuttx/fs/fs.h index 4a883792aec..f73b0b0cfcc 100644 --- a/include/nuttx/fs/fs.h +++ b/include/nuttx/fs/fs.h @@ -71,20 +71,20 @@ struct file_operations { /* The device driver open method differs from the mountpoint open method */ - int (*open)(FAR struct file *filp); + int (*open)(FAR struct file *filep); /* The following methods must be identical in signature and position because * the struct file_operations and struct mountp_operations are treated like * unions. */ - int (*close)(FAR struct file *filp); - ssize_t (*read)(FAR struct file *filp, FAR char *buffer, size_t buflen); - ssize_t (*write)(FAR struct file *filp, FAR const char *buffer, size_t buflen); - off_t (*seek)(FAR struct file *filp, off_t offset, int whence); - int (*ioctl)(FAR struct file *filp, int cmd, unsigned long arg); + int (*close)(FAR struct file *filep); + ssize_t (*read)(FAR struct file *filep, FAR char *buffer, size_t buflen); + ssize_t (*write)(FAR struct file *filep, FAR const char *buffer, size_t buflen); + off_t (*seek)(FAR struct file *filep, off_t offset, int whence); + int (*ioctl)(FAR struct file *filep, int cmd, unsigned long arg); #ifndef CONFIG_DISABLE_POLL - int (*poll)(FAR struct file *filp, struct pollfd *fds, bool setup); + int (*poll)(FAR struct file *filep, struct pollfd *fds, bool setup); #endif /* The two structures need not be common after this point */ @@ -139,7 +139,7 @@ struct mountpt_operations * information to manage privileges. */ - int (*open)(FAR struct file *filp, FAR const char *relpath, + int (*open)(FAR struct file *filep, FAR const char *relpath, int oflags, mode_t mode); /* The following methods must be identical in signature and position because @@ -147,11 +147,11 @@ struct mountpt_operations * unions. */ - int (*close)(FAR struct file *filp); - ssize_t (*read)(FAR struct file *filp, FAR char *buffer, size_t buflen); - ssize_t (*write)(FAR struct file *filp, FAR const char *buffer, size_t buflen); - off_t (*seek)(FAR struct file *filp, off_t offset, int whence); - int (*ioctl)(FAR struct file *filp, int cmd, unsigned long arg); + int (*close)(FAR struct file *filep); + ssize_t (*read)(FAR struct file *filep, FAR char *buffer, size_t buflen); + ssize_t (*write)(FAR struct file *filep, FAR const char *buffer, size_t buflen); + off_t (*seek)(FAR struct file *filep, off_t offset, int whence); + int (*ioctl)(FAR struct file *filep, int cmd, unsigned long arg); /* The two structures need not be common after this point. The following * are extended methods needed to deal with the unique needs of mounted @@ -160,7 +160,7 @@ struct mountpt_operations * Additional open-file-specific mountpoint operations: */ - int (*sync)(FAR struct file *filp); + int (*sync)(FAR struct file *filep); int (*dup)(FAR const struct file *oldp, FAR struct file *newp); /* Directory operations */ @@ -273,7 +273,7 @@ struct filelist #if CONFIG_NFILE_STREAMS > 0 struct file_struct { - int fs_filedes; /* File descriptor associated with stream */ + int fs_fd; /* File descriptor associated with stream */ #if CONFIG_STDIO_BUFFER_SIZE > 0 sem_t fs_sem; /* For thread safety */ pid_t fs_holder; /* Holder of sem */ @@ -621,7 +621,7 @@ int lib_flushall(FAR struct streamlist *list); ssize_t lib_sendfile(int outfd, int infd, off_t *offset, size_t count); #endif -/* fs/fs_read.c *************************************************************/ +/* fs/fs_fileread.c *********************************************************/ /**************************************************************************** * Name: file_read * @@ -636,7 +636,7 @@ ssize_t lib_sendfile(int outfd, int infd, off_t *offset, size_t count); ssize_t file_read(FAR struct file *filep, FAR void *buf, size_t nbytes); #endif -/* fs/fs_lseek.c ************************************************************/ +/* fs/fs_fileread.c *********************************************************/ /**************************************************************************** * Name: file_seek * diff --git a/include/unistd.h b/include/unistd.h index 46eb14cddf7..dd1ef3f5a9c 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -129,62 +129,62 @@ EXTERN int optopt; /* unrecognized option character */ /* Task Control Interfaces */ -EXTERN pid_t vfork(void); -EXTERN pid_t getpid(void); -EXTERN void _exit(int status) noreturn_function; -EXTERN unsigned int sleep(unsigned int seconds); -EXTERN int usleep(useconds_t usec); -EXTERN int pause(void); +pid_t vfork(void); +pid_t getpid(void); +void _exit(int status) noreturn_function; +unsigned int sleep(unsigned int seconds); +int usleep(useconds_t usec); +int pause(void); /* File descriptor operations */ -EXTERN int close(int fd); -EXTERN int dup(int fd); -EXTERN int dup2(int fd1, int fd2); -EXTERN int fsync(int fd); -EXTERN off_t lseek(int fd, off_t offset, int whence); -EXTERN ssize_t read(int fd, FAR void *buf, size_t nbytes); -EXTERN ssize_t write(int fd, FAR const void *buf, size_t nbytes); +int close(int fd); +int dup(int fd); +int dup2(int fd1, int fd2); +int fsync(int fd); +off_t lseek(int fd, off_t offset, int whence); +ssize_t read(int fd, FAR void *buf, size_t nbytes); +ssize_t write(int fd, FAR const void *buf, size_t nbytes); /* Special devices */ -EXTERN int pipe(int filedes[2]); +int pipe(int fd[2]); /* Working directory operations */ -EXTERN int chdir(FAR const char *path); -EXTERN FAR char *getcwd(FAR char *buf, size_t size); +int chdir(FAR const char *path); +FAR char *getcwd(FAR char *buf, size_t size); /* File path operations */ -EXTERN int unlink(FAR const char *pathname); -EXTERN int rmdir(FAR const char *pathname); +int unlink(FAR const char *pathname); +int rmdir(FAR const char *pathname); /* Execution of programs from files */ #ifdef CONFIG_LIBC_EXECFUNCS -EXTERN int execl(FAR const char *path, ...); -EXTERN int execv(FAR const char *path, FAR char *const argv[]); +int execl(FAR const char *path, ...); +int execv(FAR const char *path, FAR char *const argv[]); /* Non-standard functions to manage symbol tables */ struct symtab_s; /* See include/nuttx/binfmt/symtab.h */ -EXTERN void exec_getsymtab(FAR const struct symtab_s **symtab, FAR int *nsymbols); -EXTERN void exec_setsymtab(FAR const struct symtab_s *symtab, int nsymbols); +void exec_getsymtab(FAR const struct symtab_s **symtab, FAR int *nsymbols); +void exec_setsymtab(FAR const struct symtab_s *symtab, int nsymbols); #endif /* Other */ -EXTERN int getopt(int argc, FAR char *const argv[], FAR const char *optstring); +int getopt(int argc, FAR char *const argv[], FAR const char *optstring); /* Accessor functions intended for use only by external NXFLAT * modules. The global variables optarg, optind, and optopt cannot * be referenced directly from external modules. */ -EXTERN FAR char **getoptargp(void); /* Optional argument following option */ -EXTERN int *getopindgp(void); /* Index into argv */ -EXTERN int *getoptoptp(void); /* unrecognized option character */ +FAR char **getoptargp(void); /* Optional argument following option */ +int *getopindgp(void); /* Index into argv */ +int *getoptoptp(void); /* unrecognized option character */ #undef EXTERN #if defined(__cplusplus) diff --git a/libc/misc/lib_init.c b/libc/misc/lib_init.c index ca5e5d03746..b120b5084c7 100644 --- a/libc/misc/lib_init.c +++ b/libc/misc/lib_init.c @@ -104,7 +104,7 @@ void lib_streaminit(FAR struct streamlist *list) /* Indicate not opened */ - list->sl_streams[i].fs_filedes = -1; + list->sl_streams[i].fs_fd = -1; /* Initialize the stream semaphore to one to support one-at- * a-time access to private data sets. @@ -152,5 +152,3 @@ void lib_releaselist(FAR struct streamlist *list) #endif /* !CONFIG_NUTTX_KERNEL || __KERNEL__ */ #endif /* CONFIG_NFILE_STREAMS */ - - diff --git a/libc/stdio/lib_fclose.c b/libc/stdio/lib_fclose.c index c04537adf7a..50e7e63bcb1 100644 --- a/libc/stdio/lib_fclose.c +++ b/libc/stdio/lib_fclose.c @@ -1,7 +1,7 @@ /**************************************************************************** * libc/stdio/lib_fclose.c * - * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011, 3013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -80,9 +80,9 @@ int fclose(FAR FILE *stream) /* Check that the underlying file descriptor corresponds to an an open * file. */ - + ret = OK; - if (stream->fs_filedes >= 0) + if (stream->fs_fd >= 0) { /* If the stream was opened for writing, then flush the stream */ @@ -94,7 +94,7 @@ int fclose(FAR FILE *stream) /* Close the underlying file descriptor and save the return status */ - status = close(stream->fs_filedes); + status = close(stream->fs_fd); /* If close() returns an error but flush() did not then make sure * that we return the close() error condition. @@ -132,9 +132,9 @@ int fclose(FAR FILE *stream) stream->fs_oflags = 0; #endif - /* Setting the fs_filedescriptor to -1 makes the stream available for reuse */ + /* Setting the file descriptor to -1 makes the stream available for reuse */ - stream->fs_filedes = -1; + stream->fs_fd = -1; } /* On an error, reset the errno to the first error encountered and return @@ -151,4 +151,3 @@ int fclose(FAR FILE *stream) return OK; } - diff --git a/libc/stdio/lib_fgets.c b/libc/stdio/lib_fgets.c index 87eed285d12..198e44be59a 100644 --- a/libc/stdio/lib_fgets.c +++ b/libc/stdio/lib_fgets.c @@ -1,7 +1,7 @@ /**************************************************************************** * libc/stdio/lib_fgets.c * - * Copyright (C) 2007-2008, 2011-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2008, 2011-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -119,7 +119,7 @@ char *fgets(FAR char *buf, int buflen, FILE *stream) /* Sanity checks */ - if (!stream || !buf || buflen < 1 || stream->fs_filedes < 0) + if (!stream || !buf || buflen < 1 || stream->fs_fd < 0) { return NULL; } @@ -204,4 +204,3 @@ char *fgets(FAR char *buf, int buflen, FILE *stream) } } } - diff --git a/libc/stdio/lib_fileno.c b/libc/stdio/lib_fileno.c index f227aa372b7..dff72becc48 100644 --- a/libc/stdio/lib_fileno.c +++ b/libc/stdio/lib_fileno.c @@ -1,7 +1,7 @@ /**************************************************************************** * libc/stdio/lib_fileno.c * - * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -55,7 +55,7 @@ int fileno(FAR FILE *stream) int ret = -1; if (stream) { - ret = stream->fs_filedes; + ret = stream->fs_fd; } if (ret < 0) @@ -67,4 +67,3 @@ int fileno(FAR FILE *stream) return ret; } #endif /* CONFIG_NFILE_STREAMS */ - diff --git a/libc/stdio/lib_fseek.c b/libc/stdio/lib_fseek.c index 36216d94a94..762682cb981 100644 --- a/libc/stdio/lib_fseek.c +++ b/libc/stdio/lib_fseek.c @@ -1,7 +1,7 @@ /**************************************************************************** * libc/stdio/lib_fseek.c * - * Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008, 2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -101,7 +101,7 @@ * function on the same stream. * * Returned Value: - * Zero on succes; -1 on failure with errno set appropriately. + * Zero on succes; -1 on failure with errno set appropriately. * ****************************************************************************/ @@ -132,7 +132,5 @@ int fseek(FAR FILE *stream, long int offset, int whence) /* Perform the fseek on the underlying file descriptor */ - return lseek(stream->fs_filedes, offset, whence) == (off_t)-1 ? ERROR : OK; + return lseek(stream->fs_fd, offset, whence) == (off_t)-1 ? ERROR : OK; } - - diff --git a/libc/stdio/lib_ftell.c b/libc/stdio/lib_ftell.c index 99fc20f340d..c528c470224 100644 --- a/libc/stdio/lib_ftell.c +++ b/libc/stdio/lib_ftell.c @@ -1,7 +1,7 @@ /**************************************************************************** * libc/stdio/lib_ftell.c * - * Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2008, 2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -95,7 +95,7 @@ * stream pointed to by stream. * * Returned Value: - * Zero on succes; -1 on failure with errno set appropriately. + * Zero on succes; -1 on failure with errno set appropriately. * ****************************************************************************/ @@ -115,7 +115,7 @@ long ftell(FAR FILE *stream) * file pointer, but will return its current setting */ - position = lseek(stream->fs_filedes, 0, SEEK_CUR); + position = lseek(stream->fs_fd, 0, SEEK_CUR); if (position != (off_t)-1) { return (long)position; @@ -125,5 +125,3 @@ long ftell(FAR FILE *stream) return ERROR; } } - - diff --git a/libc/stdio/lib_libfflush.c b/libc/stdio/lib_libfflush.c index f2f0cfe144a..07b230b54f8 100644 --- a/libc/stdio/lib_libfflush.c +++ b/libc/stdio/lib_libfflush.c @@ -1,7 +1,7 @@ /**************************************************************************** * libc/stdio/lib_libfflush.c * - * Copyright (C) 2007-2008, 2011-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2008, 2011-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -112,7 +112,7 @@ ssize_t lib_fflush(FAR FILE *stream, bool bforce) /* Return EBADF if the file is not opened for writing */ - if (stream->fs_filedes < 0 || (stream->fs_oflags & O_WROK) == 0) + if (stream->fs_fd < 0 || (stream->fs_oflags & O_WROK) == 0) { return -EBADF; } @@ -150,7 +150,7 @@ ssize_t lib_fflush(FAR FILE *stream, bool bforce) { /* Perform the write */ - bytes_written = write(stream->fs_filedes, src, nbuffer); + bytes_written = write(stream->fs_fd, src, nbuffer); if (bytes_written < 0) { /* Write failed. The cause of the failure is in 'errno'. diff --git a/libc/stdio/lib_libflushall.c b/libc/stdio/lib_libflushall.c index 22baed968d1..9bb94c5c8ea 100644 --- a/libc/stdio/lib_libflushall.c +++ b/libc/stdio/lib_libflushall.c @@ -111,7 +111,7 @@ int lib_flushall(FAR struct streamlist *list) * write data in the stream. */ - if (stream->fs_filedes >= 0 && (stream->fs_oflags & O_WROK) != 0) + if (stream->fs_fd >= 0 && (stream->fs_oflags & O_WROK) != 0) { /* Flush the writable FILE */ diff --git a/libc/stdio/lib_libfread.c b/libc/stdio/lib_libfread.c index f8cf0f40af4..17b3998c2f7 100644 --- a/libc/stdio/lib_libfread.c +++ b/libc/stdio/lib_libfread.c @@ -178,7 +178,7 @@ ssize_t lib_fread(FAR void *ptr, size_t count, FAR FILE *stream) if (count > buffer_available) { - bytes_read = read(stream->fs_filedes, dest, count); + bytes_read = read(stream->fs_fd, dest, count); if (bytes_read < 0) { /* An error occurred on the read. The error code is @@ -226,7 +226,7 @@ ssize_t lib_fread(FAR void *ptr, size_t count, FAR FILE *stream) * into the buffer. */ - bytes_read = read(stream->fs_filedes, stream->fs_bufread, buffer_available); + bytes_read = read(stream->fs_fd, stream->fs_bufread, buffer_available); if (bytes_read < 0) { /* An error occurred on the read. The error code is @@ -258,7 +258,7 @@ ssize_t lib_fread(FAR void *ptr, size_t count, FAR FILE *stream) while (count > 0) { - bytes_read = read(stream->fs_filedes, dest, count); + bytes_read = read(stream->fs_fd, dest, count); if (bytes_read < 0) { /* An error occurred on the read. The error code is @@ -307,12 +307,11 @@ ssize_t lib_fread(FAR void *ptr, size_t count, FAR FILE *stream) lib_give_semaphore(stream); } - return bytes_read; + return bytes_read; /* Error exits */ errout_with_errno: lib_give_semaphore(stream); - return -get_errno(); + return -get_errno(); } - diff --git a/libc/stdio/lib_libfwrite.c b/libc/stdio/lib_libfwrite.c index b917b3b5640..e7443f996b5 100644 --- a/libc/stdio/lib_libfwrite.c +++ b/libc/stdio/lib_libfwrite.c @@ -1,7 +1,7 @@ /**************************************************************************** * libc/stdio/lib_libfwrite.c * - * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -173,7 +173,6 @@ errout: } #else { - return write(stream->fs_filedes, ptr, count); + return write(stream->fs_fd, ptr, count); } #endif /* CONFIG_STDIO_BUFFER_SIZE */ - diff --git a/libc/stdio/lib_ungetc.c b/libc/stdio/lib_ungetc.c index 178aeddd10d..9d14499d7b7 100644 --- a/libc/stdio/lib_ungetc.c +++ b/libc/stdio/lib_ungetc.c @@ -1,7 +1,7 @@ /**************************************************************************** * libc/stdio/lib_ungetc.c * - * Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008, 2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -96,7 +96,7 @@ int ungetc(int c, FAR FILE *stream) /* Stream must be open for read access */ - if ((stream && stream->fs_filedes < 0) || + if ((stream && stream->fs_fd < 0) || ((stream->fs_oflags & O_RDOK) == 0)) { set_errno(EBADF); diff --git a/net/net_vfcntl.c b/net/net_vfcntl.c index 7650264bf2b..a4c924225d3 100644 --- a/net/net_vfcntl.c +++ b/net/net_vfcntl.c @@ -1,7 +1,7 @@ /**************************************************************************** * net/net_vfcntl.c * - * Copyright (C) 2009, 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2012-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -97,14 +97,14 @@ int net_vfcntl(int sockfd, int cmd, va_list ap) case F_GETFD: /* Get the file descriptor flags defined in that are associated - * with the file descriptor fildes. File descriptor flags are associated + * with the file descriptor fd. File descriptor flags are associated * with a single file descriptor and do not affect other file descriptors * that refer to the same file. */ case F_SETFD: /* Set the file descriptor flags defined in , that are associated - * with fildes, to the third argument, arg, taken as type int. If the + * with fd, to the third argument, arg, taken as type int. If the * FD_CLOEXEC flag in the third argument is 0, the file shall remain open * across the exec functions; otherwise, the file shall be closed upon * successful execution of one of the exec functions. @@ -115,7 +115,7 @@ int net_vfcntl(int sockfd, int cmd, va_list ap) case F_GETFL: /* Get the file status flags and file access modes, defined in , - * for the file description associated with fildes. The file access modes + * for the file description associated with fd. The file access modes * can be extracted from the return value using the mask O_ACCMODE, which is * defined in . File status flags and file access modes are associated * with the file description and do not affect other file descriptors that @@ -140,7 +140,7 @@ int net_vfcntl(int sockfd, int cmd, va_list ap) case F_SETFL: /* Set the file status flags, defined in , for the file description - * associated with fildes from the corresponding bits in the third argument, + * associated with fd from the corresponding bits in the third argument, * arg, taken as type int. Bits corresponding to the file access mode and * the file creation flags, as defined in , that are set in arg shall * be ignored. If any bits in arg other than those mentioned here are changed @@ -170,18 +170,18 @@ int net_vfcntl(int sockfd, int cmd, va_list ap) break; case F_GETOWN: - /* If fildes refers to a socket, get the process or process group ID specified + /* If fd refers to a socket, get the process or process group ID specified * to receive SIGURG signals when out-of-band data is available. Positive values * indicate a process ID; negative values, other than -1, indicate a process group - * ID. If fildes does not refer to a socket, the results are unspecified. + * ID. If fd does not refer to a socket, the results are unspecified. */ case F_SETOWN: - /* If fildes refers to a socket, set the process or process group ID specified + /* If fd refers to a socket, set the process or process group ID specified * to receive SIGURG signals when out-of-band data is available, using the value - * of the third argument, arg, taken as type int. Positive values indicate a + * of the third argument, arg, taken as type int. Positive values indicate a * process ID; negative values, other than -1, indicate a process group ID. If - * fildes does not refer to a socket, the results are unspecified. + * fd does not refer to a socket, the results are unspecified. */ case F_GETLK: