On some platforms (HPUX, SOLARIS, AIX), we forcibly set CC or set a
default CC, because we must use a specific compiler to build kernel
modules, and we specify certain compiler-specific flags. But we do
this after AC_PROG_CC has run, which also searches for a compiler to
use, and runs a few tests against it. AC_PROG_CC often chooses a
different compiler (it prefers gcc if it's available).
As a result, some compiler-derived info may be wrong, which can yield
confusing results, even breaking the build depending on what the
user's PATH is, or what compilers are installed on the system.
We can avoid all of this if we move our CC-setting logic to before
AC_PROG_CC is called. This is a little tricky, because our logic to
set AFS_SYSNAME requires the C compiler, so we must do this before
OPENAFS_SYSNAME, and also before AC_USE_SYSTEM_EXTENSIONS, or any
other autoconf macro that uses the C compiler.
Move our CC-setting logic into a new macro, OPENAFS_PATH_CC, which is
separate from OPENAFS_CONFIGURE_COMMON and must be called before
OPENAFS_CONFIGURE_COMMON. Add some safeguards to try to detect if
AC_PROG_CC is already called to try to prevent future changes from
breaking this; this isn't perfect, but it's better than nothing.
Change-Id: I7c327df5acc5d1ff701b70825eecaaaab4aa44a8
Reviewed-on: https://gerrit.openafs.org/15456
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Ben Huntsman <ben@huntsmans.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
We currently use -q64 for a few commands in src/export on AIX, which
becomes -m64 when using the clang-based xlc 17.1 compiler. Specify
which flag to use in XCFLAGS64, and use that instead of hardcoding
-q64 in those commands.
Change-Id: Ia93aba9043dd9a24b1b0b4693ca498d75e8f6378
Reviewed-on: https://gerrit.openafs.org/15454
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Ben Huntsman <ben@huntsmans.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
AIX 7.2 TL5 SP3 (7200-05-03) and higher support IBM's new clang-based
Open XL C 17.1 and up. These OS releases continue to support the
traditional XL C 16.1 and below. The older compiler is still the
default compiler for the AIX kernel and the 16.1 rte is shipped with
the base OS.
Both compilers can be installed simultaneously. When compiling only
one or the other will be in $PATH. This change allows the configure
script to act appropriately based upon which compiler is being used.
Change-Id: I9f6130a574f9c48e3bbd961266f0beb5646421e3
Reviewed-on: https://gerrit.openafs.org/15436
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
afsd has quite a bit of logic for searching through an existing
OpenAFS cache dir, and removing extra cache files. Part of this logic
currently looks similar to this:
if ((vFileNum = GetDDirNumber(currp->d_name, maxDir)) >= 0) {
/* we found a valid D1234 dir */
} else if ((vFileNum = GetDDirNumber(currp->d_name, 1 << 30)) >= 0) {
/* the D1234 dir we found isn't valid, but only because its
* number was too big */
}
That is, we check if we found a valid D1234 dir, and whether or not
the number for the the dir was too high. We go into different code
paths for these, because for fully-valid dirs, we process them like
normal. For too-big dirs, we don't want to keep the dir, but we still
look inside it to potentially find valid cache files.
The problem is, GetDDirNumber doesn't actually use its second
argument; it is passed to doGetXFileNumber, where the 'maxNum'
argument is never used. Instead, we always check the interpreted
number against 'cacheFiles'; that's valid for V1234 files, but not for
D-dirs.
So, if doSweepAFSCache encounters a D-dir that is only invalid because
the number for it is too large, it will process it as if it were a
normal valid dir. That means we access cache_dir_list[vFileNum] for
that dir, but the 'cache_dir_list' array is only 'maxDir' members
long, so writing to that part of the array overwrites some other part
of memory.
As a result, if afsd is started with a cache that has D-dirs that are
much larger than the max dirs needed for the current cache, it can
easily abort or segfault as a result of memory corruption. This can
happen if a client's cache size is greatly reduced (or some other
cache parameters are changed), and the client is restarted with the
same cache dir.
Change-Id: I1057c11e2812bf93b76131007063c79d06e225a4
Reviewed-on: https://gerrit.openafs.org/12612
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Right now we set the CC for libuafs on AIX to xlc_r. But the threaded
compiler is not always xlc_r; use MT_CC to let the 'configure' logic
choose the actual compiler to use.
Change-Id: Ie5986b97b555b475abcfb9cbfc95bf5b9fbdeb6f
Reviewed-on: https://gerrit.openafs.org/15450
Reviewed-by: Ben Huntsman <ben@huntsmans.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Update the source code in src/export in various ways to use more
modern conventions:
- Get rid of K&R-style arguments. (An exception is error() and
sys_error() in cfgexport.c, which use old-style arguments as a cheap
imitation of varargs functions.)
- Declare various local functions and globals as 'static'
- Declare static functions before they are called (or move them, for
small functions like usage())
- Declare functions as returning 'int' if they had no type
- Declare all unspecified types as 'int' (function return types,
arguments, and variables)
- Include string.h for memset(), strcmp(), etc, and stdlib.h for
exit()
- Don't declare our own malloc()
- Remove a few unused or #ifdef'd out functions
Change-Id: I48f9cf72abad06d8bda8a0663e6eae3814bef86d
Reviewed-on: https://gerrit.openafs.org/15449
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Ben Huntsman <ben@huntsmans.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
The clang-based xlc 17.1 compiler on AIX throws various errors when
compiling aix_aklog.c. Fix them:
- We make a couple of pr_* calls, but don't include ptuser.h. Include
it, to get the prototypes for those functions. (Also make the tsm41
dir depend on ptserver, to ensure the header is available.)
- Include ctype.h for the functions islower(), et al.
- Move aklog_authenticate() to after auth_to_cell(), so auth_to_cell()
is defined before it is referenced.
Also declare most of our functions as 'static' while we're here.
Change-Id: I0d3ce2c1e4bab3d20969f869128fc603c71bc019
Reviewed-on: https://gerrit.openafs.org/15448
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Ben Huntsman <ben@huntsmans.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
We define static_inline to just 'static' on AIX, presumably because
old xlc versions could not handle 'static inline'. The clang-based xlc
17.1 can, though, so allow the normal 'static inline' if we detect
clang being used.
Doing this is not required to build, but it gets rid of a lot of noisy
-Wunused-function warnings when building.
Change-Id: I44d165549dbd0002a733318daa32da23c9e51a29
Reviewed-on: https://gerrit.openafs.org/15444
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
We currently only allocate 50 or 100 (depending on platform) dir
buffers for the buffer cache, which seems very low. Raise it to 2048,
and make it consistent for all platforms, to give the buffers a chance
at actually usefully caching data.
Change-Id: If95eafde771993532dac08057cbd1e1a8cef915c
Reviewed-on: https://gerrit.openafs.org/13532
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Commit beff42414a (aix-5-update-20041207) added -qlanglvl=stdc99 to
our CFLAGS for libuafs, apparently to handle __file__ (or __FILE__) in
afs_osi_pag.c.
The clang-based xlc 17.1 on AIX does not understand this argument,
which causes an error:
CC .../src/libuafs/afs_osi_pag.lo
.ibm-clang: error: unknown argument: '-qlanglvl=stdc99'
afs_osi_pag.c doesn't directly use __FILE__. Various other files in
src/afs indirectly reference __FILE__, so this probably is not needed
at all anymore. Just remove it.
Change-Id: Iae33a80dd96aef94e3be2f97590e40ffa1c6ba29
Reviewed-on: https://gerrit.openafs.org/15447
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
In various places, we make direct libafs syscalls. On platforms with a
dedicated libafs syscall number, this involves passing AFS_SYSCALL to
a generic OS-provided function that issues the given syscall (usually
called syscall()).
On AIX, there is no generic syscall() function for issuing system
calls. Instead, system calls are treated like function calls, and are
translated into system calls at link-time. So our calls to e.g.
lpioctl() and lsetpag() are issuing system calls on AIX, and we have
no userspace definition of these functions.
Along with lpioctl() and lsetpag(), libafs also defines a system call
confusingly named 'syscall'. Since this is our system call, of course
the system headers provide no declaration for it, and so this causes
errors when building using the clang-based xlc 17.1, such as:
.../src/volser/volmain.c:195:2: error: call to undeclared function 'syscall'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
syscall(AFS_SYSCALL /* AFS_SYSCALL */ , 28 /* AFSCALL_CALL */ , a3,
^
To avoid these errors, declare a prototype for syscall(). But be clear
that this is a function (technically a system call) provided by
OpenAFS, not by the OS.
Ideally our prototype would match the definition of syscall() in
afs_syscall.c, but our various callers pass a varying number of
arguments (as is normal for syscall() on other platforms). So at least
for now, declare it as a function with unspecified args.
Change-Id: Ica43e56e19f59155fe21fe8fdeb52525b2f678e9
Reviewed-on: https://gerrit.openafs.org/15446
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
We currently define COMPAT_43 for AIX. This causes some socket-related
structures and functions to be defined to be compatible with BSD 4.3,
but causes us to not get function prototypes for recvmsg() and
sendmsg(). When using the clang-based XLC 17.1, this causes errors:
.../src/rx/rx_lwp.c:414:12: error: call to undeclared function 'recvmsg'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
code = recvmsg(socket, msg_p, flags);
^
.../src/rx/rx_lwp.c:432:12: error: call to undeclared function 'sendmsg'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
while (sendmsg(socket, msg_p, flags) == -1) {
^
To avoid this, don't define COMPAT_43. To try to make sure we don't
change anything when using the old xlc, still define COMPAT_43 when
we're not using clang.
Change-Id: I4971df46f0b8e10463c42938d12fa27dff514da7
Reviewed-on: https://gerrit.openafs.org/15445
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Commit 6b96a49eb6 "Retire AFS_MOUNT_AFS" removed all AFS_MOUNT_AFS
references. However, a few were inadvertently reintroduced with the
following commits:
f379e1b255 "macos: Add support for MacOS 14.X (Sonoma)"
e5a97ef2b4 "macos: Add support for MacOS 13.0 (Ventura)"
7a862f940b "macos: Add support for MacOS 12.0"
39b74c2c37 "macos: Refactor param.x86_darwin_200.h"
acc955bc17 "macos: add support for MacOS 11.0"
Remove them.
No functional change is incurred by this commit.
[mmeffie: Remove ones added by 14.x too]
Change-Id: Iaf93e27eabbe23a9054d695bc13a43163943f5b1
Reviewed-on: https://gerrit.openafs.org/15453
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
If we're going to call rcu_read_lock(), we're also going to need to
call rcu_read_unlock(). Make sure both functions are available before
saying that rcu_read_lock is available.
Without this, trying to use rcu_read_lock/unlock can result in errors
during the kernel build for kernels where rcu_read_unlock calls
rcu_read_unlock_strict (a GPLONLY function). This started in Linux
commit aa40c138cc8f (rcu: Report QS for outermost PREEMPT=n
rcu_read_unlock() for strict GPs), which was included in Linux 5.10.
Change-Id: I1d2d5272c722d60ec55dcfd6c07b79e4edfc995b
Reviewed-on: https://gerrit.openafs.org/14876
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Get rid of some remaining references to bcopy, bzero, and bcmp. In a
few places (such as ka-forwarder.c, and linked_list.c), these were
being called without including strings.h, which causes errors on AIX
when using the clang-based xlc 17.1 compiler.
Remove references even inside comments or documentation, to make it
easier to make sure they've all been removed.
Leave some references inside platform-specific or kernel code, since
those are more likely to need bcopy() et al, and tend to only impact
that platform.
Note that most references to bcopy() et al were removed by commit
c5c521af0e
(convert-from-bsd-to-posix-string-and-memory-functions-20010807).
Change-Id: I28d1b139348c2a4b2259a259de0c93997c684c40
Reviewed-on: https://gerrit.openafs.org/15432
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Add the -localauth option to the libadmin rxstat sample programs which
require a token. This allows the use of these rxstat commands on the
server when the cache manager is not available.
Change-Id: If0d4d12abc80df73da5898ebb0052fb61d23cb48
Reviewed-on: https://gerrit.openafs.org/12376
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Add a libadmin function to support the -localauth option instead
of retrieving a token from the cache manager.
Change-Id: Ie6aa6f3f48e39e0b8dbab7fec83369e41d441e45
Reviewed-on: https://gerrit.openafs.org/12375
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Use the libcmd library to parse rxstat_* command line arguments, instead
of custom code in each program. The positional argument syntax is
unchanged by this commit. Optional command line switches for the
arguments are now supported, as a feature of libcmd.
This also fixes the incorrect usage messages in several of the commands.
Change-Id: I5df9b9a439bc12e7c1090abc9713e5245d666c1b
Reviewed-on: https://gerrit.openafs.org/12374
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Various parts of dumpscan use ctime(), time(), etc, but don't include
time.h. This causes errors on AIX when using the clang-based xlc 17.1,
such as:
.../src/tools/dumpscan/parsevol.c:286:35: error: call to undeclared function 'ctime'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
printf("%s%s", field->label, ctime(&when));
^
Include time.h in these files, so we have declarations for these
functions.
Change-Id: I0247a55952640585ff3b27d2b0e47e09dea531a0
Reviewed-on: https://gerrit.openafs.org/15435
Reviewed-by: Ben Huntsman <ben@huntsmans.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
The AIX-specific tweak_config() clearly doesn't return a value, so
don't say it does.
Change-Id: I8b4535427438cb05c4243b4ef2a875c685c7bb76
Reviewed-on: https://gerrit.openafs.org/15434
Reviewed-by: Ben Huntsman <ben@huntsmans.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
The AIX-specific functions aix_vmount() and vmountdata() are missing
return types, and vmountdata is referenced before we declare it. These
cause errors when using the clang-based xlc 17.1:
.../src/afsd/afsd_kernel.c:386:1: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
aix_vmount(const char *cacheMountDir)
^
int
.../src/afsd/afsd_kernel.c:407:5: error: call to undeclared function 'vmountdata'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
vmountdata(vmountp, "AFS", cacheMountDir, "", "", "", "rw");
^
.../src/afsd/afsd_kernel.c:415:1: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
vmountdata(struct vmount * vmtp, char *obj, char *stub, char *host,
^
Declare these 'static' and with proper return types, and move
aix_vmount() so it's after vmountdata().
Change-Id: Ie31dddaae515c914087a34efacfe3427eda22d0b
Reviewed-on: https://gerrit.openafs.org/15433
Reviewed-by: Ben Huntsman <ben@huntsmans.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
kaserver.c redefines vfprintf in terms of the historical _doprnt
function, presumably to work around quirks of old platforms. This
should not be necessary anymore, since we call vfprintf() normally in
various other places throughout the tree without trouble.
Using _doprnt causes problems on various platforms (as can be seen by
the long #ifdef before it), including now AIX when using the
clang-based xlc 17.1:
.../src/kauth/kaserver.c:99:5: error: call to undeclared function '_doprnt'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
vfprintf(stderr, fmt, pvar);
^
.../src/kauth/kaserver.c:60:35: note: expanded from macro 'vfprintf'
#define vfprintf(stream,fmt,args) _doprnt(fmt,args,stream)
^
Instead of adding more conditions to the #ifdef, just get rid of this
weird workaround altogether.
Change-Id: Ie4e965229ed8e8636c6e6405cc33a4937e2ccabc
Reviewed-on: https://gerrit.openafs.org/15431
Reviewed-by: Ben Huntsman <ben@huntsmans.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
For most platforms, LWP_CreateProcess2 is #define'd to be the same as
LWP_CreateProcess. For AFS_AIX32_ENV, it is actually a different
function, but we don't declare it in a header. The clang-based xlc
17.1 complains about this:
.../src/lwp/iomgr.c:670:6: error: call to undeclared function 'LWP_CreateProcess2'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
LWP_CreateProcess2(p, stackSize, LWP_NORMAL_PRIORITY,
^
.../src/lwp/iomgr.c:670:6: note: did you mean 'LWP_CreateProcess'?
.../src/lwp/lwp.h:262:12: note: 'LWP_CreateProcess' declared here
extern int LWP_CreateProcess(void *(*ep)(void *), int stacksize, int priority,
^
Declare this in lwp.h, like we do for the normal LWP_CreateProcess.
Change-Id: I18e6d4436ae4c58f3ffb6fe57158e6869f0b36b5
Reviewed-on: https://gerrit.openafs.org/15430
Reviewed-by: Ben Huntsman <ben@huntsmans.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Fix the indentation of a closing brace that was accidentally
extra-indented in e93786b01b (vol: remove OPENAFS_VOL_STATS).
Change-Id: I25627531fe9f4f07138a917b6c576f6ab22dd036
Reviewed-on: https://gerrit.openafs.org/15464
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Since the original IBM code import, this file has not been built or
referenced. Remove it.
No functional change is incurred by this commit.
Change-Id: Iee8a077767bf7774f7f6b586501aea8a0fc88a3f
Reviewed-on: https://gerrit.openafs.org/15677
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
For 64-bit Solaris 11 kernel builds on SPARC, use '-m64' instead of the
long-deprecated "-xarch=v9". This will eliminate the warning:
Warning: -xarch=v9 is deprecated, use -m64 to create 64-bit programs
The two options are functionally equivalent, so no functional change
should be incurred by this commit.
Change-Id: I6a4043a9e6dfad509fe1be3dd4071e5e77d31133
Reviewed-on: https://gerrit.openafs.org/15360
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Since its introduction in commit 5ec5ad5dcc 'New GetToken pioctl',
PGetTokens2 has had a stray semicolon after its closing '}'. This may
generate a compiler warning:
warning: syntax error: empty declaration
Remove the superfluous semicolon.
No functional change is incurred by this commit.
Change-Id: I49c220781d8d9c8d65a28996fbc0dbad803ca49b
Reviewed-on: https://gerrit.openafs.org/15357
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
When building with Solaris Studio, we receive warnings about the type of
the event passed to the LWP functions.
CC /export/home/vagrant/openafs/src/vol/volume.o
"volume.c", line 662: warning: argument #1 is incompatible with prototype:
prototype: pointer to void : ".../include/lwp.h", line 273
argument : pointer to function(enum {volumeSalvager(7), ...)
returning int (E_ARG_INCOMPATIBLE_WITH_ARG_L)
In particular, this happens in src/vol/volume.c because our "events" are
function pointers and the LWP functions expect a pointer to a void.
As needed, cast the event pointer to the expected (void *) to eliminate
the warnings.
[mmeffie: Rebase and update commit message.]
Change-Id: I619a52326914aeff66263e62490de3b6d3b0c9ac
Reviewed-on: https://gerrit.openafs.org/15356
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: Michael Meffie <mmeffie@sinenomine.net>
The following fields in struct vcache are never used (despite what
some comments suggest):
- next_seq_offset
- next_seq_blk_offset
- xlatordv
- protocol
- vpacRock
Remove them, to reduce the memory impact of our vcaches. While we're
here, also move around some fields to reduce the amount of unnecessary
padding and reduce #ifdefs:
- diskSlot
- activeV
- vstates
- multiPage
- callback
- vc_error
- dchint
- dcreaddir
- pagewriter_lock
- pagewriters
On amd64 RHEL7, this commit reduces the size of struct vcache by 40
bytes (from 1024 to 984).
Change-Id: I0cb6aedacc3cee56b952b3c5a6ec6a2d318043a8
Reviewed-on: https://gerrit.openafs.org/15211
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Convert all hardcoded $(AR) options to use configuration variable
ARFLAGS.
No functional change should be incurred by this commit.
Change-Id: I3a0840e58d8996d60c119c6d5df1ab8d985ba0d8
Reviewed-on: https://gerrit.openafs.org/14896
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Commit e4c2810f41 'Remove support for Solaris pre-8' overlooked some
references to pre-8 SunOS versions in lwp/Makefile.in. Remove them.
Change-Id: I3ca5498444569134e1e9720efb96c84c61cdf799
Reviewed-on: https://gerrit.openafs.org/15366
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
We currently do not build 'fc_test' or any of the programs in
src/rxkad/test, and they've bitrotted as a result. Clean them up so
they can build again, and make them all built by default.
Some of these programs depend on higher-level libraries (like
libafsauthent) that depend on rxkad, so we cannot build the test
programs during the top-level 'make rxkad' target. So instead, create
a new top-level target called 'rxkad_test' that just builds the test
programs. Move 'fc_test' into the test subdir to make it easier to
build with the other test programs.
Change-Id: Ic5570efd9076e3e4feec18002d67ce8d58f321d1
Reviewed-on: https://gerrit.openafs.org/14750
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Since the original IBM code import, libbubasics.a has been built with a
hardcoded 'ar' instead of the customary $(AR).
For consistency with the rest of the tree (and in preparation for a
future commit), convert this to use $(AR) instead.
While here, also change the options from 'r' to the more typical 'crv'.
Change-Id: If74e4b92188af9de7f504e3f588b7ee1070425fc
Reviewed-on: https://gerrit.openafs.org/14895
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Currently, when sleeping on LINUX, we either block all signals
(afs_osi_Sleep), or do not block signals at all (afs_osi_SleepSig).
The only caller of afs_osi_SleepSig() is afs_read(), with the
intention that a user can interrupt the process while it's waiting for
data from an unresponsive server.
This can cause problems when afs_read() is called during a paging
request. In this case, if we are interrupted by a signal, we'll return
an error (EINTR) from afs_linux_readpage(), which causes a SIGBUS to
be sent to the process if it's not already dying.
If we're interrupted by a fatal signal, the process is already dying
so this is fine. But if we're interrupted by a non-fatal signal with
an installed signal handler, the SIGBUS almost always causes the
process to die immediately (and maybe dump core), where it otherwise
would have been fine.
This can be very confusing to a user when it happens, since it's not
immediately obvious that AFS was involved at all; the dumped core
often just shows the SIGBUS generated during a mundane memory load or
store. This situation is most easily seen when running golang out of
/afs, but has also been seen with git and other programs. Anything
that makes heavy use of signals while data is being fetched from /afs
is likely to trigger the behavior.
This problem in general may not be specific to Linux, since the
relevant code path is in cross-platform code (afs_read ->
afs_osi_SleepSig). But notably, this does not happen on Solaris[1];
other platforms may have their own quirks that prevent this from
becoming a problem.
To avoid this for Linux, block all signals except SIGKILL when we're
sleeping via afs_osi_SleepSig(). This allows the process to be killed
if needed, but prevents interruption from any non-fatal signal.
Ideally we would put our process in TASK_KILLABLE state, using
functions like wait_event_killable() or wait_event_state() instead of
blocking signals. But these functions have evolved over time, making
this approach complex or even impossible for various Linux versions in
our current design. Future commits may improve this; for now, do the
simpler fix and just block signals.
We could theoretically still allow non-fatal signals to interrupt
sleeps when called from a syscall like read(). But this is difficult
with the current structure of our Linux integration (syscall i/o is
implemented on top of the paging system, like most Linux filesystems),
and other filesystems tend to not do this.
Also, interrupting a stalled afs_read() in general doesn't currently
work very well anyway. The only callers of afs_osi_SleepSig() look
like this, to wait for a background fetch (BOP_FETCH) to complete:
while (!code && tdc->mflags & DFFetchReq) {
/* other locks, etc */
ReleaseReadLock(&tdc->lock);
code = afs_osi_SleepSig(&tdc->validPos);
ObtainReadLock(&tdc->lock);
}
A signal will cause afs_osi_SleepSig() to return, but then we must
wait to get tdc->lock. The background BOP_FETCH operation will keep
tdc->lock write-locked for the entire fetch from the fileserver
(afs_CacheFetchProc()), so we won't be able to continue until the
fetch completes.
Future commits may improve this, but for now just avoid the
unnecessary SIGBUS errors.
[1] On Solaris, the equivalent code path (afs_GetOnePage()) does not
go through afs_read() with noLock==0, but instead calls
afs_GetDCache() to handle fetching data. It does call afs_ustrategy()
to fill a page, which does technically call afs_read(), but with
noLock==1, and so avoids the case where we submit a BOP_FETCH and
wait for it. Fetching data from the network happens in the
afs_GetDCache() call, and so does not use afs_osi_SleepSig().
Change-Id: Ic9c0c35bd1a2a8fd1901d91dae10cb7719194d25
Reviewed-on: https://gerrit.openafs.org/15637
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
The output for 'fs getfid' was changed in commit d390df097c (fs getfid
output changed for consistency with Windows implementation), but the
manpage still had the old output in its examples. Update the manpage
to reflect the current behavior of 'fs getfid'.
Change-Id: Iea7a92cdb30ca6f935121aba26a072288b404567
Reviewed-on: https://gerrit.openafs.org/15587
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Instead of having afs_osi_Sleep() call afs_osi_SleepSig() directly,
have both afs_osi_Sleep() and afs_osi_SleepSig() call a common helper
function, afs_linux_sleep(). This makes it easier for future commits
to alter the behavior for the _Sleep and _SleepSig variants.
This commit should incur no noticeable change in behavior. We now
manipulate the signal mask outside of AFS_GLOCK, but this doesn't matter
because 'current' and the signal mask are unrelated to any of our locks.
The signal mask is protected by SIG_LOCK (a wrapper from osi_machdep.h
for various different locks for different kernel versions), and is
handled in this commit the same as it was before.
Change-Id: Id14c44b22cf2a1883deaf6ceec66f71f3f4778a6
Reviewed-on: https://gerrit.openafs.org/15636
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Commit d1923139e6 (irix kill efs and start pruning pre-65) removed
most pre-6.5 Irix code, but there are still numerous references laying
around. Get rid of them.
Change-Id: I5e8b092374c616ccec84d195021a8bee78a4cea2
Reviewed-on: https://gerrit.openafs.org/15455
Reviewed-by: Ben Huntsman <ben@huntsmans.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Commit f896be7dd5 dirpath-mrafs-additions-20010212 inadvertently
introduced duplicate entries for several AFS path definitions via a
cut-and-paste mistake.
Remove the duplicate definitions.
While here, move a server definition into the correct category.
No functional change is incurred by this commit.
Change-Id: Icf88ee9f74f8a7c72cd7cd2abf8b128f5651f4b5
Reviewed-on: https://gerrit.openafs.org/15420
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Add a makefile target to start an interactive subshell with the
environment required to run tests directly from the command line. Tests
can also be run from a debugger or from the "runtests" front-end test
runner.
Example usage:
$ make shell
...
Starting a shell to run tests. Run 'exit' when done.
# Set the subshell prompt (optional).
$ PS1="(tests) $PS1"
# Run tests directly or with a debugger.
(tests) $ rx/perf-t
...
(tests) $ file rx/perf-t
rx/perf-t: Perl script text executable
(tests) $ perl -d rx/perf-t
...
# End the subshell.
(tests) $ exit
$
The shell started will be the one discovered by configure, which may not
be the preferred shell for interactive use. To specify a different
shell, define SHELL when running make:
$ make shell SHELL=/path/to/my/shell
If you use this feature often, you may want to update your shell profile
to automatically set the PS1 when running the test subshell. For
example, you can append this to your bashrc file:
# OpenAFS unit test subshell.
if [[ $MAKECHECK -eq 1 ]]; then
PS1="(tests) $PS1"
fi
Thanks to Ben Kaduk for the suggestion.
Change-Id: I8d949d21153396c0da8db186fd35477ad0383f12
Reviewed-on: https://gerrit.openafs.org/15730
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Commit b0818fcdb2 'Cleaned most warning
OSX OpenAFS preference and completed the AFSBackgrounder implementation'
removed mention of afsltd.m from the xcode project, but neglected to
remove the actual source code file afsltd.m.
Remove the dead code.
No functional change is incurred by this commit.
Change-Id: I85f9a0842187c39a40cb8492e60a9371d6ff041d
Reviewed-on: https://gerrit.openafs.org/14591
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Add makefile variables to specify if we are to build the userspace
and/or kernel module (kmod) packages. Continue to build both by
default.
Change-Id: Idc20d5140fcb60cbe84a500b2a7580866008e3e0
Reviewed-on: https://gerrit.openafs.org/15407
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Currently, when building the source RPM with make, the release notes and
change log are empty, and the CellServDB file is downloaded from
grand.central.org.
Instead, by default, package the NEWS file for the release notes, the
ChangeLog generated by the 'make-release' script, and a CellServDB file
in the source tree.
Add the RPM_RELNOTES and RPM_CHANGELOG makefile variables so we can
override the defaults if builders want to provide their own release
notes and change log files. Builders can specify empty values on the
make command line to fallback to empty files for the RELNOTES and
ChangeLog (which was the old behavior before this change).
Add the RPM_CELLSERVDB makefile variable to specify the local CellServDB
file to be packaged. By default, package src/afsd/CellServDB from the
working tree (which matches the one specified in the openafs.spec.in
used to build the source rpm). Builders can specify an empty
RPM_CELLSERVDB on the make command line to have makesrpm.pl download the
CellServDB file from grand.central.org (which was the old behavior
before this change).
Change-Id: Idf1afd1683d87d882d2c7e49058cbf18839e5c9e
Reviewed-on: https://gerrit.openafs.org/15406
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
The 'packages' directory is created by the top makefile when building
source tarballs and RPM package files. Remove this directory when
running 'make clean', just like we already do for the output of the
legacy 'make dest' target.
Change-Id: Icc912e8025d15dd2f3f52c9ffaa9d29f8c19268b
Reviewed-on: https://gerrit.openafs.org/15475
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
In Makefile.config.in, the Makefile variable TOP_JLIBDIR is set to the
autoconf variable TOP_JLIBDIR. Except, we don't export anything called
TOP_JLIBDIR from autoconf, and never have. So, TOP_JLIBDIR gets set to
the literal string @TOP_JLIBDIR@, which is useless.
To get rid of this cruft, just remove references to this variable in
the top-level Makefile.in and Makefile.config.in, where it was clearly
not working.
[mmeffie: Updated commit message after rebase.]
Change-Id: Ic7e64d3743c99065dea8371bdc1007835c94edbd
Reviewed-on: https://gerrit.openafs.org/13810
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Permissions granted by host-based ACLs and non-host-based ACLs are
calculated separately (and transmitted somewhat differently, via
AnonymousAccess). So, if a caller is granted permissions via normal
user-based access, those permissions cannot be removed by host-based
entries in a negative ACL. And conversely, permissions granted by
host-based entries cannot be removed by negative ACLs for
non-host-based entries.
Both negative ACLs and host-based ACLs are uncommon and recommended
against, so this should not be a common combination. But this
limitation is not documented anywhere, so try to mention it in the
fs_setacl manpage, near some other text related to negative ACLs, to
give affected users a chance to figure out why it isn't working.
Change-Id: I13ba2adda1474a5e72271d3e843bb03feec29b67
Reviewed-on: https://gerrit.openafs.org/15340
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
The OpenAFS preferences for MacOS provide two ways to start or stop the
cache manager:
- Preference pane button: [Startup] or [Shutdown]
- AFS Menu item: 'Startup AFS' or 'Shutdown AFS'
Only one choice (startup or shutdown) is displayed in each UI element,
based on the current state of the cache manager according to
checkAfsStatus().
Unfortunately, checkAfsStatus() determines cache manager state by
issuing a 'df' command and searching the output for AFS_FS_MOUNT "AFS".
This heuristic is fragile and easily fooled by any "AFS" string in the
output.
For example, the OpenAFS installer .dmg mounts itself as "OpenAFS". The
presence of "AFS" causes checkAfsStatus to believe that AFS is mounted.
Therefore the OpenAFS GUI will display only the "Shutdown" choice,
regardless of the true state of AFS. If AFS is already shutdown, it is
impossible to start the cache manager via the GUI until the installer
image is ejected.
Modify checkAfsStatus to use a more robust method of determining the
state of AFS: Iterate over the mounted devices to search for a mounted
AFS filesystem.
Change-Id: I3144de9d53aed0a8673cc8d869107f012728fd7c
Reviewed-on: https://gerrit.openafs.org/14587
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>