* shm.cc (shmat): Return (void *) -1 on error instead of NULL.
This commit is contained in:
parent
f241377ee1
commit
83216c72ec
|
@ -1,3 +1,7 @@
|
||||||
|
2004-03-28 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* shm.cc (shmat): Return (void *) -1 on error instead of NULL.
|
||||||
|
|
||||||
2004-03-27 Christopher Faylor <cgf@redhat.com>
|
2004-03-27 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
* fhandler_nodevice.cc (fhandler_nodevice::open): Assume that errno has
|
* fhandler_nodevice.cc (fhandler_nodevice::open): Assume that errno has
|
||||||
|
|
|
@ -162,7 +162,7 @@ shmat (int shmid, const void *shmaddr, int shmflg)
|
||||||
{
|
{
|
||||||
/* Invalid shmid */
|
/* Invalid shmid */
|
||||||
set_errno (EINVAL);
|
set_errno (EINVAL);
|
||||||
return NULL;
|
return (void *) -1;
|
||||||
}
|
}
|
||||||
vm_object_t attach_va = NULL;
|
vm_object_t attach_va = NULL;
|
||||||
if (shmaddr)
|
if (shmaddr)
|
||||||
|
@ -176,7 +176,7 @@ shmat (int shmid, const void *shmaddr, int shmflg)
|
||||||
if (!attach_va || (vm_offset_t)attach_va % SHMLBA)
|
if (!attach_va || (vm_offset_t)attach_va % SHMLBA)
|
||||||
{
|
{
|
||||||
set_errno (EINVAL);
|
set_errno (EINVAL);
|
||||||
return NULL;
|
return (void *) -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Try allocating memory before calling cygserver. */
|
/* Try allocating memory before calling cygserver. */
|
||||||
|
@ -184,7 +184,7 @@ shmat (int shmid, const void *shmaddr, int shmflg)
|
||||||
if (!sph_entry)
|
if (!sph_entry)
|
||||||
{
|
{
|
||||||
set_errno (ENOMEM);
|
set_errno (ENOMEM);
|
||||||
return NULL;
|
return (void *) -1;
|
||||||
}
|
}
|
||||||
DWORD access = (shmflg & SHM_RDONLY) ? FILE_MAP_READ : FILE_MAP_WRITE;
|
DWORD access = (shmflg & SHM_RDONLY) ? FILE_MAP_READ : FILE_MAP_WRITE;
|
||||||
vm_object_t ptr = MapViewOfFileEx(ssh_entry->hdl, access, 0, 0,
|
vm_object_t ptr = MapViewOfFileEx(ssh_entry->hdl, access, 0, 0,
|
||||||
|
@ -193,7 +193,7 @@ shmat (int shmid, const void *shmaddr, int shmflg)
|
||||||
{
|
{
|
||||||
__seterrno ();
|
__seterrno ();
|
||||||
delete sph_entry;
|
delete sph_entry;
|
||||||
return NULL;
|
return (void *) -1;
|
||||||
}
|
}
|
||||||
/* Use returned ptr address as is, so it's stored using the exact value
|
/* Use returned ptr address as is, so it's stored using the exact value
|
||||||
in cygserver. */
|
in cygserver. */
|
||||||
|
@ -206,7 +206,7 @@ shmat (int shmid, const void *shmaddr, int shmflg)
|
||||||
set_errno (request.error_code ());
|
set_errno (request.error_code ());
|
||||||
if (request.error_code () == ENOSYS)
|
if (request.error_code () == ENOSYS)
|
||||||
raise (SIGSYS);
|
raise (SIGSYS);
|
||||||
return NULL;
|
return (void *) -1;
|
||||||
}
|
}
|
||||||
sph_entry->ptr = ptr;
|
sph_entry->ptr = ptr;
|
||||||
sph_entry->hdl = ssh_entry->hdl;
|
sph_entry->hdl = ssh_entry->hdl;
|
||||||
|
@ -217,7 +217,7 @@ shmat (int shmid, const void *shmaddr, int shmflg)
|
||||||
#else
|
#else
|
||||||
set_errno (ENOSYS);
|
set_errno (ENOSYS);
|
||||||
raise (SIGSYS);
|
raise (SIGSYS);
|
||||||
return NULL;
|
return (void *) -1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue