summaryrefslogtreecommitdiff
path: root/ipc.c (follow)
Commit message (Collapse)AuthorAge
* Merge topic branch t/spdx into masterAndre Noll2026-03-26
|\ | | | | | | | | | | | | | | | | | | | | Switch to SPDX licence identifiers A single patch which replaces the first comment line of most .c and .h files containing the copyright notice by standardized SPDX (Software/System Package Data Exchange) nomenclature. * t/spdx: Switch to SPDX identifiers.
| * Switch to SPDX identifiers.Andre Noll2026-03-17
| | | | | | | | | | | | | | | | Generated with sed -i 's|Copyright.*Andre Noll.*|SPDX-License-Identifier: GPL-2.0 */|g' *.c *.h followed by manually tweaking the result a bit. No license change intended.
* | ipc.c: Drop return value of mutex_destroy().Andre Noll2026-03-18
|/ | | | | No caller checks the return value. Log a message on errors rather than fail silently.
* ipc: Clamp shmmax to 10M.Andre Noll2025-08-26
| | | | The old setting may cause OOM on low-memory 32 bit systems.
* ipc: Remove pointless initialization in shm_get_shmmax().Andre Noll2024-05-07
| | | | The subsequent read() call overwrites the buffer.
* Avoid warning about sys/sysctl.h on glibc-2.30.Andre Noll2019-09-01
| | | | | | | | | | | | | | | | | | From glibc-2.30 NEWS: The Linux-specific <sys/sysctl.h> header and the sysctl function have been deprecated and will be removed from a future version of glibc. Compilation against the glibc-2.30 headers results in the following warning: In file included from ipc.c:10: /usr/include/sys/sysctl.h:21:2: warning: #warning "The <sys/sysctl.h> header is deprecated and will be removed." [-Wcpp] On NetBSD and FreeBSD, however, we still need to include the header to get the declaration of sysctlbyname(3). This patch changes ipc.c to include sys/sysctl.h only if __FreeBSD__ or __NetBSD__ is defined. Also remove the pointless check for __APPLE__.
* Shorten copyright notice.Andre Noll2017-09-22
| | | | | | | | | | | | | | | | | | | | | The GPLv2 line does not add any additional information, so drop it. This leaves a single line of legalese text for most files, which is about the amount of screen real estate it deserves. This patch was created with the following script (plus some manual fixups): awk '{ if (NR <= 5) { gs = gensub(/.*Copyright.* ([0-9]+).*Andre Noll.*/, "\\1", "g") if (gs != $0) year = gs next } if (NR == 6 && year != "") printf("/* Copyright (C) %s Andre Noll <maan@tuebingen.mpg.de>, see file COPYING. */\n", year) print }'
* doxygen: Add \ref to references.Andre Noll2017-06-25
| | | | | This way doxygen issues a warning if the file/function/structure no longer exists and a stale reference remains.
* load_chunk_table(): Don't trust afhi->chunks_total.Andre Noll2017-03-25
| | | | | | | | | | | | | | | | | | Both callers pass a buffer to load_chunk_table() to initialize afhi->chunk_table. The function does not check the size of the passed buffer but relies on afhi->chunks_total to tell how many values to copy from the buffer. In other words, the buffer size gives an upper bound for the number of chunks in the chunk table, but this bould is not checked. This patch makes the code more robust by adding a suitable check. To this aim, load_chunk_table() is changed to receive a pointer to an osl object (which contains the buffer size) rather than only the buffer. One caller, load_afd(), initializes the chunk table from a shared memory area buffer. It does not know or care about the buffer size so far. We introduce the the new IPC helper shm_size() to let it tell the size of the area and pass it to load_chunk_table().
* Update year in copyright headers.Andre Noll2015-01-12
| | | | | | | | | | | | | | | | Done with files=$(git grep -l 'Copyright (C) [0-9]\{4\}\(-2014\)* Andre Noll') sed --in-place= -e 's/Copyright (C) \([0-9]\{4\}\)-2014 Andre Noll/Copyright (C) \1 Andre Noll/1' $files In previous years we ran a similar script to set the second year in the range to the current year. This is kind of silly, so let's get rid of this useless information. This commit replaces "Copyright (C) A-B" by "Copyright (C) A" in all file headers, i.e. only the first year (A) is left in. Accurate information including time stamps for each change can be obtained from the git history.
* doc: Change email address to maan@tuebingen.mpg.deAndre Noll2014-08-18
| | | | | | | | | | | | | | The mail server on systemlinux.org was down for more than a week lately, so let's use an alternative official address. This commit changes all maan@systemlinux.org addresses to maan@tuebingen.mpg.de. Most .c and .h files contain the email address in the copyright header, so they must all be patched. Three other files contain the address for a different reason: * README lists email and git, gitweb and home page URLs * configure.ac needs it for configure -h * version.c contains it for the -V option of all commands
* Change copyright year to 2014.Andre Noll2014-02-22
| | | | | | | | | This year, we're really on time. The changes in this patch were created by the following silly script: files=$(git grep -l 'Copyright (C) [0-9]\{4\}\(-2013\)* Andre Noll') sed --in-place= -e 's/Copyright (C) \([0-9]\{4\}\)-2013 Andre Noll/Copyright (C) \1-2014 Andre Noll/1' $files sed --in-place= -e 's/Copyright (C) 2013 Andre Noll/Copyright (C) 2013-2014 Andre Noll/1' $files
* ipc: Close proc fd.Andre Noll2013-09-04
| | | | | We read shmmax only once, so there is no point in keeping this file descriptor open forever.
* ipc.c: Fix typo in comment.Andre Noll2013-07-21
|
* Change copyright year to 2013.Andre Noll2013-03-25
| | | | Better late than never.
* Change year in copyright message to 2012.Andre Noll2012-01-07
|
* doc: Add some missing doxygen comments.Andre Noll2011-10-15
|
* ipc: Determine maximal size of a shared memory area at runtime.Andre Noll2011-09-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During command dispatch, the afs process allocates shm areas for the query result and passes the identifiers via the local socket to the child process of para_server which is executing the command. If the write to the (non-blocking) local socket fails, for example because the call would block, afs closes the connection to the child process immediately to avoid deadlocks. Therefore the maximal output size of an (afs) command depends linearly on the size of the shared memory areas, so it is desirable to allocate areas as large as possible. Currently, we use the SHMMAX if it is defined and fall back to the safe default value of 64K otherwise. However, this default is much smaller than the typical limit of 32M on Linux. Moreover, the maximal size of a shared memory area (shmmax) can be set at any time on most if not all operating systems, so runtime detection of shmmax is to be preferred. Unfortunately the way to obtain shmmax varies between operating systems. On Linux, the value is available as the contents of a file in /proc while on {Free,Net}BSD and Darwin sysctlbyname() must be called. Moreover, BSD and Darwin use different identifiers for the sysctlbyname() call. So any code that determines shmmax at runtime and works on all of the above systems must necessarily be ugly. This patch tries to concentrate all ugliness in the new shm_get_shmmax() function, so that the changes outside of ipc.c consist only of replacements SHMMAX -> shm_get_shmmax() and of the removal of the default SHMMAX setting. The new function only determines shmmax once when it is called for the first time.
* Replace 2010 in copyright message by 2011.Andre Noll2011-01-17
|
* Change year in COPYRIGHT to 2010.Andre Noll2010-04-05
| | | | Hey, this is earlier than last year :)
* Change year of copyright from 2008 to 2009.Andre Noll2009-01-10
|
* Replace ipc error codes by system error codes.Andre Noll2008-04-12
|
* ipc.c: Cosmetics.Andre Noll2008-04-12
|
* Change year in Copyright comment from 2007 to 2008.Andre Noll2008-01-08
|
* Fix some gcc warnings on Solaris:Andre Noll2007-12-04
| | | | | | | warning: int format, pid_t arg warning: int format, long int arg int format, uid_t arg int format, gid_t arg
* ipc.c: Improve para_semop().Andre Noll2007-09-08
| | | | | It's kind of silly to retry the semop 500 times. Just check if sempop() was interrupted and retry in this case. Otherwise, error out.
* replace standard GPL header by a one-line pointer to COPYINGAndre Noll2007-06-28
|
* be more carful wrt. signed vs. unsigned argument passingAndre Noll2007-05-26
|
* ipc.c: documentation fixesAndre2007-01-05
|
* small header cleanupAndre2006-04-07
|
* another typo in commentAndre2006-02-24
| | | | ipc.c:44: Warning: expected whitespace after param command
* fix another typo in commentAndre2006-02-22
|
* add more ipc documentationAndre2006-02-22
| | | | Also, add a GPL header and replace "shared memory area" by "shared memory segment".
* Avoid busy loop if someone nasty removes the semaphores currently in use.Andre2006-02-21
| | | | Just die if semop failed 500 times.
* fix the plm database toolAndre2006-02-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (Re)loading the playlist uses the new mutex and shm helpers and is hopefully a race-free implementation. It works as follows: The plm init function (parent, server context) reserves a shared memory area (client data) as well as two unlocked mutexes. The first mutex serializes access for racing clients that want to replace the playlist. The second mutex serializes the access between parent and child (com_lpl()). com_lpl() loads the playlist from the client into a tmp buffer. It then creates a shm area (client_shm) and copies that buffer to the area. Further, another mutex (shm) is created. This mutex is initially locked. Next, it grabs the client lock and the server lock, and updates client_data with the id of client_shm. Then the parent is woken up (SIGUSR1) and the server lock is released. com_lpl() finally goes to sleep by acquiring the shm lock. In this situation, only the parent may run. It grabs the server lock, reads client_data to attach client_shm and reloads the playlist with data from client_shm. When ready, the parent detaches client_shm, and drops the shm lock and the server lock. This wakes up com_lpl() which destroys client_shm, the shm mutex and the tmp buffer.
* The new ipc subsystemAndre2006-02-21
Contains functions for dealing with mutexes and shared memory.