From: Sergey Vlasov <vsu@altlinux.ru>
To: devel-kernel@altlinux.ru
Subject: Re: [d-kernel] shmctl: Invalid argument
Date: Tue, 9 Dec 2003 17:55:49 +0300
Message-ID: <20031209145549.GH835@master.mivlgu.local> (raw)
In-Reply-To: <20031209172932.709fe253.bga@altlinux.ru>
[-- Attachment #1: Type: text/plain, Size: 1169 bytes --]
On Tue, Dec 09, 2003 at 05:29:32PM +0300, Grigory Batalov wrote:
> После переезда с ядра 2.4.20-alt10-smp на 2.4.22-std-smp-alt12
> от программы amdump (пакет amanda) наблюдаются сообщения:
>
> taper: FATAL shmctl: Invalid argument
>
> Я просмотрел исходники taper, его манипуляции с памятью
> можно упростить до прилагаемого файла.
> Указанное сообщение соответствует коду в taper.c:
>
> if(shmid == -1) return; /* nothing to destroy */
> if(shmctl(shmid, IPC_RMID, NULL) == -1) {
> error("shmctl: %s", strerror(errno));
> }
>
> При запуске shmtest обычным пользователем видно, что память
> выделяется и затем (через заданные 5 сек.) освобождается:
>
> $ ipcs
> ------ Shared Memory Segments --------
> key shmid owner perms bytes nattch status
> 0x00000000 262150 bga 700 1048576 1
> <skip>
>
> Однако, на ядре 2.4.20-alt10-smp программа завершается
> молча, а на 2.4.22-std-smp-alt12 выходит сообщение:
>
> ./shmtest: : Unknown error 2339276
Не воспроизводится...
И программа с ошибками - попробуйте приложенный исправленный вариант.
gcc -o shmtest -g -O2 -Wall -W shmtest.c
[-- Attachment #2: shmtest.c --]
[-- Type: text/plain, Size: 761 bytes --]
#define _GNU_SOURCE
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <error.h>
#include <stdlib.h>
int main(void)
{
int shmid = -1;
char *result;
shmid = shmget(IPC_PRIVATE, 1024*1024, IPC_CREAT|0700);
if(shmid == -1) {
error(0, errno, "shmget");
exit(1);
}
result = (char *)shmat(shmid, NULL, 0);
if(result == (char *)-1) {
int save_errno = errno;
if(shmctl(shmid, IPC_RMID, NULL) == -1) {
error(0, errno, "shmctl");
}
error(0, save_errno, "shmat");
exit(1);
}
sleep(5);
if(shmctl(shmid, IPC_RMID, NULL) == -1) {
error(0, errno, "shmctl");
exit(1);
}
if(shmdt(result) == -1) {
error(0, errno, "shmdt");
exit(1);
}
exit(0);
}
next prev parent reply other threads:[~2003-12-09 14:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-09 14:29 Grigory Batalov
2003-12-09 14:50 ` Dmitry V. Levin
2003-12-09 14:55 ` Sergey Vlasov [this message]
2003-12-10 6:42 ` Grigory Batalov
2003-12-11 9:57 ` Denis Ovsienko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20031209145549.GH835@master.mivlgu.local \
--to=vsu@altlinux.ru \
--cc=devel-kernel@altlinux.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
ALT Linux kernel packages development
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/devel-kernel/0 devel-kernel/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 devel-kernel devel-kernel/ http://lore.altlinux.org/devel-kernel \
devel-kernel@altlinux.org devel-kernel@altlinux.ru devel-kernel@altlinux.com
public-inbox-index devel-kernel
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.devel-kernel
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git