Back to index

glibc  2.9
shmat.c File Reference
#include <errno.h>
#include <sys/shm.h>
#include <ipc_priv.h>
#include <sysdep.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <bp-checks.h>

Go to the source code of this file.


void * shmat (int shmid, const void *shmaddr, int shmflg)

Function Documentation

void* shmat ( int  shmid,
const void *  shmaddr,
int  shmflg 

Definition at line 34 of file shmat.c.

  void *__unbounded result;
  void *__unbounded raddr;

  size_t length = ~0;
  struct shmid_ds shmds;
  /* It's unfortunate that we need to make another system call to get
     the shared memory segment length...  */
  if (shmctl (shmid, IPC_STAT, &shmds) == 0)
    length = shmds.shm_segsz;

  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;

  return BOUNDED_N (result, length);

Here is the call graph for this function: