mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-30 22:43:12 +03:00
Fix SHMLBA on sparc.
[BZ #6471] * sysdeps/unix/sysv/linux/shmat.c (shmat): Test for syscall errors properly. * sysdeps/unix/sysv/linux/sparc/getshmlba.c: New file. * sysdeps/unix/sysv/linux/sparc/Makefile: Add getshmlba to sysdep_routines when subdir is sysvipc. * sysdeps/unix/sysv/linux/sparc/bits/shm.h (SHMLBA): Use new __getshmlba helper.
This commit is contained in:
@ -35,7 +35,8 @@ shmat (shmid, shmaddr, shmflg)
|
||||
const void *shmaddr;
|
||||
int shmflg;
|
||||
{
|
||||
void *__unbounded result;
|
||||
INTERNAL_SYSCALL_DECL(err);
|
||||
unsigned long resultvar;
|
||||
void *__unbounded raddr;
|
||||
|
||||
#if __BOUNDED_POINTERS__
|
||||
@ -47,12 +48,15 @@ shmat (shmid, shmaddr, shmflg)
|
||||
length = shmds.shm_segsz;
|
||||
#endif
|
||||
|
||||
result = (void *__unbounded) INLINE_SYSCALL (ipc, 5, IPCOP_shmat,
|
||||
shmid, shmflg,
|
||||
(long int) __ptrvalue (&raddr),
|
||||
__ptrvalue ((void *) shmaddr));
|
||||
if ((unsigned long) result <= -(unsigned long) SHMLBA)
|
||||
result = raddr;
|
||||
resultvar = INTERNAL_SYSCALL (ipc, err, 5, IPCOP_shmat,
|
||||
shmid, shmflg,
|
||||
(long int) __ptrvalue (&raddr),
|
||||
__ptrvalue ((void *) shmaddr));
|
||||
if (INTERNAL_SYSCALL_ERROR_P (resultvar, err))
|
||||
{
|
||||
__set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, err));
|
||||
return (void *) -1;
|
||||
}
|
||||
|
||||
return BOUNDED_N (result, length);
|
||||
return BOUNDED_N (raddr, length);
|
||||
}
|
||||
|
Reference in New Issue
Block a user