Re: [CYGWIN] ipc-daemon

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [CYGWIN] ipc-daemon
Дата
Msg-id 29845.1036438981@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [CYGWIN] ipc-daemon  (Peter Eisentraut <peter_e@gmx.net>)
Ответы Re: [CYGWIN] ipc-daemon  (Jason Tishler <jason@tishler.net>)
Re: [CYGWIN] ipc-daemon  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
> Jason Tishler writes:
>> 1. If ipc-daemon is not running, then cygipc's shmget() will return
>> EACCES.
>> 2. This causes PostgreSQL's InternalIpcMemoryCreate() to return
>> NULL.
>> 3. This causes PostgreSQL's PGSharedMemoryCreate() to spin looking
>> for accessible shared memory which it will never find.

> To me, this is a bug in PostgreSQL.

I disagree: just because cygipc returns error codes chosen at random
doesn't mean that we should neglect the clear meaning of an error code.
If a normal Unix system were to return EACCES here, the clear
implication would be that there is an existing segment that we do not
have permission to access.  I don't see how "cygipc isn't running"
can reasonably be translated into "permission denied".

>> After reading the shmget() man page, I choose to return ENOSPC.  Is
>> there a better choice?  Such as ENOMEM?

> My first thought was ENOSYS (system call not implemented -- what BSD
> kernels tend to return if you didn't compile them with SysV IPC support),
> but that isn't a clearly superior choice either.

If you can detect that cygipc is not running, then ENOSYS seems the
best choice for reporting that.  (ENOSPC would be misleading too.)

If it's impractical to fix cygipc then I'd grudgingly go along with

        if (errno == EEXIST
#ifndef __CYWGIN__                   /* cygipc is broken */
            || errno == EACCES
#endif
#ifdef EIDRM
            || errno == EIDRM
#endif
            )
            return NULL;


            regards, tom lane

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Is my Internet connection slow
Следующее
От: Alessio Bragadini
Дата:
Сообщение: Re: Request for supported platforms