summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2014-06-30libpipe: fix spurious calls to pipe_sendRichard Braun
* libpipe/pipe.c (pipe_send): Skip processing if there is nothing to send.
2014-06-28Revert "libpipe: fix calls to pipe_send with no data"Richard Braun
This reverts commit 6f856c62613ffc82bf3572a372d2851638c2fb90. As the comment right above the change says, "this [sending control packets] depends on the fact that we always write a data packet".
2014-06-28libpipe: fix calls to pipe_send with no dataRichard Braun
* libpipe/pipe.c (pipe_send): Check that there actually is any data to send before calling the pipe write operation.
2014-06-23ext2fs: use correct type for block numbersJustus Winter
* ext2fs/dir.c (count_dirents): Use block_t for nb. (diskfs_get_directs): Likewise for blkno, nblks.
2014-06-23libdiskfs: fix deadlockJustus Winter
Previously, libdiskfs would deadlock on contention on renamedirlock due to the lock being taken spuriously. Found using fsstress from the Linux Test Project. * libdiskfs/dir-rename.c (diskfs_S_dir_rename): Remove spurious pthread_mutex_lock.
2014-06-22libdiskfs: expose the ST_NOATIME flagPino Toscano
Expose ST_NOATIME as flag (if available in glibc) if diskfs is set in noatime mode. * libdiskfs/file-statfs.c (diskfs_S_file_statfs): Set ST_NOATIME if _DISKFS_NOATIME is set.
2014-06-18libdiskfs: add permission check to file_chflagsJustus Winter
Only root is allowed to change the high 16 bits. The TODO entry says otherwise, but that must be a mistake. For reference, see the glibc sources, sysdeps/mach/hurd/bits/stat.h. * libdiskfs/file-chflags.c (diskfs_S_file_chflags): Add permission check. * TODO (libdiskfs): Remove entry.
2014-06-18libports: avoid realloc(3) corner caseJustus Winter
If the size argument is 0, realloc may either return NULL, or return a pointer that is only valid for use with free(3). In either case, the memory is freed. So if realloc would return NULL (it does not on GNU), the current code would double free p. Found using the Clang Static Analyzer. * libports/bucket-iterate.c (_ports_bucket_class_iterate): Avoid calling realloc if no ports were matched.
2014-06-18trans/fakeroot: fix error handlingJustus Winter
Found using the Clang Static Analyzer. * trans/fakeroot.c (new_node): Do not leak a pointer to freed memory. Store NULL at *np instead. This fixes a node use-after-free in netfs_S_dir_lookup.
2014-06-18libshouldbeinlibc: fix dead initialization in fmt_named_intervalJustus Winter
Found using the Clang Static Analyzer. * libshouldbeinlibc/timefmt.c (fmt_named_interval): Fix dead initialization.
2014-06-18ftpfs: fix error handling in refresh_dirJustus Winter
Found using the Clang Static Analyzer. * ftpfs/dir.c (refresh_dir): Fix error handling.
2014-06-17Add mach_debug defs rulesDavid Michael
* Makeconf (mach_debug_defs_names,mach_debug_defs): New variables. * Makeconf: Add rule to generate local $(mach_debug_defs) files. * procfs/Makefile: Remove vpath for mach_debug defs.
2014-06-15Add the procfs translator to prog-subdirsJustus Winter
* Makefile (prog-subdirs): Add procfs.
2014-06-15Merge procfs into the Hurd repositoryJustus Winter
2014-06-15Prepare the procfs translator to be merged into the Hurd sourcesJustus Winter
Move the procfs translator to its own subdirectory 'procfs'. This is the last commit to this repository. Development of the procfs translator will continue in the main Hurd repository. * procfs/Makefile: Replace the standalone Makefile with the one from the Debian packaging repository.
2014-06-15Merge branch 'merge-random'Justus Winter
2014-06-15utils/settrans: implement settrans --startJustus Winter
Start the translator specified by the NODE's passive translator record and set it as NODE's active translator. This is the equivalent of doing: % settrans --active /node $(showtrans /node) * utils/settrans.c (argp_option): Add --start. (parse_opt): Handle --start. (main): Retrieve the passive translator record if --start is given.
2014-06-15hurd: fix receiver lookup in termctty_open_terminalJustus Winter
* hurd/hurd_types.h (ctty_t): New type definition. * hurd/term.defs (ctty_t): New type definition. * term/mig-decls.h: New file. * term/mig-mutate.h: Add mutators, includes. * term/term.h: Add include guards. * term/users.c (S_termctty_open_terminal): Fix receiver lookup. * boot/boot.c (S_termctty_open_terminal): Likewise.
2014-06-15term: improve the demuxerJustus Winter
Handle multiple request types as recommended by the Mach Server Writer's Guide section 4, subsection "Handling Multiple Request Types". This avoids initializing the reply message in every X_server function. * term/main.c (demuxer): Improve the demuxer function.
2014-06-09Add the random translator to prog-subdirsJustus Winter
* Makefile (prog-subdirs): Add random.
2014-06-09Merge the random translator into the Hurd repositoryJustus Winter
2014-06-09Prepare the random translator to be merged into the Hurd sourcesJustus Winter
Move the random translator to its own subdirectory 'random'. This is the last commit to this repository. Development of the random translator will continue in the main Hurd repository.
2014-06-08ext2fs: fix type of retry_dotdotJustus Winter
* ext2fs/dir.c (diskfs_lookup_hard): Use ino_t for retry_dotdot.
2014-06-08ext2fs: fix type of blockaddrJustus Winter
* ext2fs/dir.c (diskfs_lookup_hard): Use vm_address_t for blockaddr.
2014-06-08ext2fs: use size_t where appropriateJustus Winter
* extfs/dir.c: Use size_t where appropriate.
2014-06-06ext2fs: fix compiler warningJustus Winter
* ext2fs/pager.c (disk_cache_block_ref): block cannot be negative.
2014-06-06libdiskfs: avoid implicit integer conversionJustus Winter
* libdiskfs/boot-start.c (diskfs_boot_start): Avoid implicit integer conversion.
2014-06-06libdiskfs: use correct type for disk offsetsJustus Winter
* libdiskfs/diskfs.h (struct peropen): Use off_t for filepointer.
2014-06-06hurd: fix type of optimal_transfer_sizeJustus Winter
* hurd/shared.h (struct shared_io): Use blksize_t for optimal_transfer_size.
2014-06-06include: use unsigned literal in combination with binary notJustus Winter
* include/refcount.h (refcounts_promote): Use ~0U. (refcounts_demote): Likewise.
2014-05-31libnetfs: fix memory leakJustus Winter
* libnetfs/trans-callback.c (_netfs_translator_callback2_fn): Free user if creating the protid failed.
2014-05-31tmpfs: use a thread timeoutJustus Winter
There is no need to keep all the threads around, just the master thread. * tmpfs/tmpfs (diskfs_thread_function): Use a thread timeout.
2014-05-30Merge branch 'random' of ssh://git.savannah.gnu.org/srv/git/hurd/incubator ↵Samuel Thibault
into random
2014-05-30Fix buffer allocation on io_readSamuel Thibault
* random.c (trivfs_S_io_read): Catch buffer allocation error, and truncate allocation when we return less data than requested.
2014-05-30build: Remove checks for 'getgrouplist' and 'uselocale'.Ludovic Courtès
GNU libc has had them for a long time. * configure.ac: Remove checks for 'getgrouplist' and 'uselocale'. * libshouldbeinlibc/idvec-impgids.c (_merge_implied_gids): Remove #ifdef HAVE_GETGROUPLIST and remove #else arm. * libthreads/cthreads.c: Remove #ifdef HAVE_USELOCALE, keeping its bodies.
2014-05-30Merge branch 'master' of git://git.sv.gnu.org/hurd/hurdJustus Winter
2014-05-30libstore: provide function declaration until available upstreamJustus Winter
Until the Hurd specific header is available, provide a local declaration of ped_device_new_from_store. * libstore/part.c (ped_device_new_from_store): New declaration.
2014-05-29Merge branch 'master' of git.savannah.gnu.org:/srv/git/hurd/hurdSamuel Thibault
2014-05-29Disable linking when cross-compilingLudovic Courtès
* configure.ac: Call AC_NO_EXECUTABLES when cross-compiling.
2014-05-29libdiskfs: use a hash table for the name cacheJustus Winter
Previously, name cache lookup operation completed in O(n) time. This means that making the cache too large would decrease the performance. Therefore it was required to tune the size. Implement the name cache using a hash table. We use buckets of a fixed size. We approximate the least-frequently used cache algorithm by counting the number of lookups using saturating arithmetic in the two lowest bits of the pointer to the name. Using this strategy we achieve a constant worst-case lookup and insertion time. Since we are not bound by the size of the cache anymore, increase its size from 200 to 1024. * libdiskfs/name-cache.c: Implement the name cache using a hash table. (diskfs_enter_lookup_cache): Change accordingly. (diskfs_purge_lookup_cache): Likewise. (diskfs_check_lookup_cache): Likewise. Also, hard code a cache miss for the parent of the root directory and merge unlocking and releasing of node references.
2014-05-29libdiskfs: remove the statistics code from the name cacheJustus Winter
The current name cache lookup operation completes in O(n) time. This means that making the cache too large would decrease the performance. Therefore it was required to tune the size, hence the need for statistics. We will use a data structure with worst case constant lookup times in the future, removing the need to fine tune the cache size. * libdiskfs/name-cache.c: Remove the statistics code from the name cache.
2014-05-28trans/fakeroot: use netfs_node_netnode instead of np->nnJustus Winter
When using fat nodes, expressions of the form E->nn can be rewritten as netfs_node_netnode (E). This is much faster as it only involves a offset calculation. For reference, I used the following semantic patch to create the patch: @@ expression E; @@ - E->nn + netfs_node_netnode (E) * trans/fakeroot.c: Use netfs_node_netnode instead of np->nn.
2014-05-28trans/fakeroot: use fat nodes to simplify the node cacheJustus Winter
Previously, fakeroot stored netnodes in the hash table. But we are not interested in a cache for netnodes, we need a node cache. So fakeroot kept pointers to the associated node object in each netnode object. Use fat netfs nodes, which combine node and netnode objects. * trans/fakeroot.c (struct netnode): Remove np. (idport_ihash): Fix ihash location pointer offset. (new_node): Allocate fat nodes, store the node pointer in the hash table. (netfs_node_norefs): Adjust accordingly. (netfs_S_dir_lookup): Likewise.
2014-05-28libnetfs: add netfs_make_node_alloc to allocate fat nodesJustus Winter
libnetfs has two kind of nodes, struct node and struct netnode. struct node is used to store libnetfs specific data, while struct netnode contains user supplied data. Previously, both objects were allocated separatly, and a pointer from the node to the netnode provided a mapping from the former to the latter. Provide a function netfs_make_node_alloc that allocates both nodes in a contiguous region. This reduces the memory allocation overhead when creating nodes. It also makes the relation between node and netnode a simple offset calculation. Provide two functions to compute the netnode address from the node address and vice-versa. Most notably, this makes implementing a cache on top of libnetfs easier. Auxiliary data for the cache can be stored in the user-defined netnode, and the fat node can be used as the value. * libnetfs/make-node.c (init_node): Move initialization here. (netfs_make_node): Use init_node. (netfs_make_node_alloc): New function to allocate fat nodes. * libnetfs/netfs.h (netfs_make_node_alloc): New declaration. (_netfs_sizeof_struct_node): Likewise. (netfs_node_netnode): Compute netnode address from node address. (netfs_netnode_node): And vice-versa. * libnetfs/init-init.c (_netfs_sizeof_struct_node): New variable.
2014-05-28libdiskfs: add diskfs_make_node_alloc to allocate fat nodesJustus Winter
libdiskfs has two kind of nodes, struct node and struct netnode. struct node is used to store libdiskfs specific data, while struct netnode contains user supplied data. Previously, both objects were allocated separatly, and a pointer from the node to the netnode provided a mapping from the former to the latter. Provide a function diskfs_make_node_alloc that allocates both nodes in a contiguous region. This reduces the memory allocation overhead when creating nodes. It also makes the relation between node and netnode a simple offset calculation. Provide two functions to compute the netnode address from the node address and vice-versa. Most notably, this makes implementing a cache on top of libdiskfs easier. Auxiliary data for the cache can be stored in the user-defined netnode, and the fat node can be used as the value. * libdiskfs/node-make.c (init_node): Move initialization here. (diskfs_make_node): Use init_node. (diskfs_make_node_alloc): New function to allocate fat nodes. * libdiskfs/diskfs.h (diskfs_make_node_alloc): New declaration. (_diskfs_sizeof_struct_node): Likewise. (diskfs_node_disknode): Compute disknode address from node address. (diskfs_disknode_node): And vice-versa. * libdiskfs/init-init.c (_diskfs_sizeof_struct_node): New variable.
2014-05-28Do not include the terminating zero in /proc/slabinfoJustus Winter
* rootdir.c (rootdir_gc_slabinfo): Do not zero-terminate the generated content.
2014-05-26libtrivfs: lock-less reference counting for trivfs_peropen objectsJustus Winter
* libtrivfs/trivfs.h (struct trivfs_peropen): Use refcount_t for field refcnt. (struct trivfs_control): Remove unused field lock. * libtrivfs/cntl-create.c (trivfs_create_control): Drop the mutex initialization. * libtrivfs/io-reauthenticate.c (trivfs_S_io_reauthenticate): Adjust accordingly. * libtrivfs/io-restrict-auth.c (trivfs_S_io_restrict_auth): Likewise. * libtrivfs/open.c (trivfs_open): Initialize refcnt. * libtrivfs/protid-clean.c (trivfs_clean_protid): Likewise. * libtrivfs/protid-dup.c (trivfs_protid_dup): Likewise.
2014-05-26libihash: do not use an integer hash function by defaultJustus Winter
Recently libihash was changed to use an integer hash function on the keys in an attempt to reduce the rate of collisions (2d898893), which has long been assumed to be high. Richard Braun was kind enough to run some benchmarks. He observed: "1/ Using an extremely simple microbenchmark [1] that merely inserts keys, either random integers or sequential ones to match the way port names are managed, it seems that the previous code, despite its apparent flaws, did quite well. [1] http://darnassus.sceen.net/gitweb/rbraun/ihtest.git Using an integer hashing function actually reduces performance on the sequential integer test case. It makes sense because, considering a set of consecutive integers starting from 0, and a hash table that always has more slots than items, a modulo is a perfect hash function. Even when taking into account that only names for receive rights are normally managed with libihash, i.e. that keys aren't actually sequential, they are almost all equally distributed, leading to very few collisions. Therefore, as a third option, I've removed the hashing function, leaving only a fast modulo (an AND) and this variant provided the best raw results. 2/ I've also built hurd packages multiple times and got average build times with each variant (previous, new, new without hash function) and here are the results I obtained respectively : 52m59s, 52m31s, 52m22s." Do not use the integer hash function on the keys by default. * libihash/ihash.c (murmur3_mix32): Remove now unused function. (find_index): Use the fast division method to derive the index. (add_one): Likewise. Also, update the comment to reflect the current hashing method.
2014-05-26libdiskfs: fix node leak in the name cacheJustus Winter
* libdiskfs/name-cache.c (diskfs_check_lookup_cache): Release node reference in a special case of lookup failure.
2014-05-26trans/mtab: fix initializationJustus Winter
* trans/mtab.c (main): Fix initialization of mtab in one-shot mode.