You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/03/02 13:53:25 UTC

[GitHub] [incubator-nuttx] patacongo removed a comment on pull request #2518: sched: Implement getpid and gettid correctly

patacongo removed a comment on pull request #2518:
URL: https://github.com/apache/incubator-nuttx/pull/2518#issuecomment-788924592


   Perhaps we could put the changes on a branch.  I could help out some with the conversion.
   
   However, we should wait until after the next 10.1.x release to give the changes as much time as possible to mature before 10.2.
   
   There should be no real use of the (corrected) getpid within the OS other than at the OS API.  There are several functions that take the pid as a parameter (and usually if the pid is zero, then it should use getpid() to get the pid of the caller).  I suppose these should return only information for the main thread:
   
   ```
   sched.h:int    task_delete(pid_t pid);
   sched.h:int    task_restart(pid_t pid);
   sched.h:int    sched_setparam(pid_t pid, FAR const struct sched_param *param);
   sched.h:int    sched_getparam(pid_t pid, FAR struct sched_param *param);
   sched.h:int    sched_setscheduler(pid_t pid, int policy,
   sched.h:int    sched_getscheduler(pid_t pid);
   sched.h:int    sched_rr_get_interval(pid_t pid, FAR struct timespec *interval);
   sched.h:int    sched_setaffinity(pid_t pid, size_t cpusetsize,
   sched.h:int    sched_getaffinity(pid_t pid, size_t cpusetsize, FAR cpu_set_t *mask);
   signal.h:int  kill(pid_t pid, int signo);
   spawn.h:int posix_spawnp(FAR pid_t *pid, FAR const char *path,
   spawn.h:int posix_spawn(FAR pid_t *pid, FAR const char *path,
   spawn.h:int task_spawn(FAR pid_t *pid, FAR const char *name, main_t entry,
   termios.h:pid_t tcgetsid(int fd);
   unistd.h:pid_t   vfork(void);
   unistd.h:pid_t   getpid(void);
   unistd.h:pid_t   gettid(void);
   unistd.h:pid_t   getppid(void);
   ```
   
   And for some associated system calls:
   
   ```
   sched.h:FAR struct tcb_s *nxsched_get_tcb(pid_t pid);
   sched.h:pid_t nxtask_start_vfork(FAR struct task_tcb_s *child);
   sched.h:int group_exitinfo(pid_t pid, FAR struct binary_s *bininfo);
   sched.h:int nxsched_get_param (pid_t pid, FAR struct sched_param *param);
   sched.h:int nxsched_set_param(pid_t pid, FAR const struct sched_param *param);
   sched.h:int nxsched_get_scheduler(pid_t pid);
   sched.h:int nxsched_set_scheduler(pid_t pid, int policy,
   sched.h:int nxsched_get_affinity(pid_t pid, size_t cpusetsize, FAR cpu_set_t *mask);
   sched.h:int nxsched_set_affinity(pid_t pid, size_t cpusetsize,
   sched.h:int nxsched_get_stackinfo(pid_t pid, FAR struct stackinfo_s *stackinfo);
   sched.h:pid_t nx_wait(FAR int *stat_loc);
   sched.h:pid_t nx_waitpid(pid_t pid, FAR int *stat_loc, int options);
   signal.h:int nxsig_kill(pid_t pid, int signo);
   signal.h:int nxsig_notification(pid_t pid, FAR struct sigevent *event,
   
   ```
   Within the OS, I think that all of the internal calls to getpid() can be converted gettid().
   
   There is also a lot of naming of variables and structure fields that would need to be corrected.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org