aclaration about local stat structs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi 

I found on posix  writev that stbuf is local , but a ptr to it is returned to caller.

int32_t
posix_writev (call_frame_t *frame,
              xlator_t *this,
              fd_t *fd,
              struct iovec *vector,
              int32_t count,
              off_t offset)
{
  int32_t op_ret;
  int32_t op_errno;
  int32_t _fd;
  struct posix_private *priv = this->private;
  data_t *pfd_data = dict_get (fd->ctx, this->name);
  struct posix_fd *pfd;
  struct stat stbuf = {0,};

...
...
  STACK_UNWIND (frame, op_ret, op_errno, &stbuf);

}

Upper modules (for example my pet QUOTA) declare args as:

static int32_t
quota_writev_cbk (call_frame_t *frame,
                  void *cookie,
                  xlator_t *this,
                  int32_t op_ret,
                  int32_t op_errno,
                  struct stat *buf)

Shouldnt be stat declared as 'struct stat const *buf'?
 also as stat is local to posix_writev can two or more threads hold a ponter to it while serving diferent requests
and thus cause a race condition??


regards, Angel
-- 
------------------------------------------------
Clist UAH
------------------------------------------------




[Index of Archives]     [Gluster Users]     [Ceph Users]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux