bsd: Change again recently-changed rwlock API

This patch removes the readers() method of rwlock, as we don't have any
use for the actual number of readers - just for the question of whether
there are any. So we replace unsigned readers() by bool has_readers().
I don't want us to unnecessarily have a readers-count method that we
don't need, because some scalable rwlock implementations don't actually
keep a coherent count of readers across all CPUs, just knowledge of
whether there are any (see for example, C-SNZI).

The patch also renames rw_rowned() to rw_has_readers(), calling the
above has_readers(). We add a comment explaining that this function
is very different from rw_owned(), in that rw_owned() checks if *this*
thread owns the write lock, while rw_has_readers() checks if *any*
thread has the read lock.

Reviewed-by: Gleb Natapov <gleb@cloudius-systems.com>
Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
path lookup: allow null pointer for name argument

The name argument only contains a pointer to the place in the string where the
basename is. In many sitations, we are not interested in such information.
Declaring a variable just for that is just clutter. Allow it to take a null
parameter.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
fs: implement lutimes

Most of the code is common to utimes. This patch then factors out utimes (now
do_utimes) and sys_utimes to accept a flags paramater, and then implements both
utimes and lutimes based on it.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
tests: return a failure code if tst-utimes fails

tst-utimes.so is currently always returning 0, and relying on strings only to
mark success/failure. It's better to reflect that in the return code.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
tst: increment tst-utimes with lutimes functionality

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
libc: implement glibc's glob_pattern_p

Currently, glob is implemented but glob_pattern_p is not. This function
can trivially be implemented with existing glob machinery, since all it
does is to tell whether or not the string contains special symbols. This
is basically the same logic as is_literal, but with inverted return value.

The value of the "quote" parameter should also be inverted, since the man
page states that when the quote parameter is *non*-zero, then backslashes
are ignored. is_literal ignores them when useesc is *zero*.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>