Hi! > > in negative case: > > > > QUICK_TEST(sched_getaffinity(getpid()+1, len, mask)); > > > > sometimes getpid()+1 will exist if there're other processes running. > > This patch uses a different way to make sure the required pid doesn't > > exist by forking a child and terminating it. The pid of the terminated > > child will not be used for a short time and it's enough for the test to > > continue. > > pid_t is signed on FreeBSD and Linux, so it's safe to assume that a pid > of -1 won't work. It all depends on what you're trying to achieve (the EINVAL > or the ESRCH requirement). > Testing to make sure that a pid isn't running via kill(pid, 0) is > another semi-viable method, but it's also racy.
On Linux we could use /proc/sys/kernel/pid_max value + 1 value too. But that would probably lead to EINVAL as well as -1. -- Cyril Hrubis [email protected] ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
