1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-28 01:58:17 +03:00

s3: lib: Add 'int op' parameter to fcntl_getlock().

Will allow us to move to open file description locks
from process-associated locks.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Jeff Layton <jlayton@samba.org>
This commit is contained in:
Jeremy Allison 2016-05-12 20:57:36 +02:00
parent 1863e6da0a
commit bb93b24b18
3 changed files with 7 additions and 6 deletions

View File

@ -385,7 +385,7 @@ bool is_in_path(const char *name, name_compare_entry *namelist, bool case_sensit
void set_namearray(name_compare_entry **ppname_array, const char *namelist);
void free_namearray(name_compare_entry *name_array);
bool fcntl_lock(int fd, int op, off_t offset, off_t count, int type);
bool fcntl_getlock(int fd, off_t *poffset, off_t *pcount, int *ptype, pid_t *ppid);
bool fcntl_getlock(int fd, int op, off_t *poffset, off_t *pcount, int *ptype, pid_t *ppid);
bool is_myname(const char *s);
void ra_lanman_string( const char *native_lanman );
const char *get_remote_arch_str(void);

View File

@ -1150,13 +1150,13 @@ void set_namearray(name_compare_entry **ppname_array, const char *namelist_in)
F_UNLCK in *ptype if the region is unlocked). False if the call failed.
****************************************************************************/
bool fcntl_getlock(int fd, off_t *poffset, off_t *pcount, int *ptype, pid_t *ppid)
bool fcntl_getlock(int fd, int op, off_t *poffset, off_t *pcount, int *ptype, pid_t *ppid)
{
struct flock lock;
int ret;
DEBUG(8,("fcntl_getlock fd=%d offset=%.0f count=%.0f type=%d\n",
fd,(double)*poffset,(double)*pcount,*ptype));
DEBUG(8,("fcntl_getlock fd=%d op=%d offset=%.0f count=%.0f type=%d\n",
fd,op,(double)*poffset,(double)*pcount,*ptype));
lock.l_type = *ptype;
lock.l_whence = SEEK_SET;
@ -1164,7 +1164,7 @@ bool fcntl_getlock(int fd, off_t *poffset, off_t *pcount, int *ptype, pid_t *ppi
lock.l_len = *pcount;
lock.l_pid = 0;
ret = sys_fcntl_ptr(fd,F_GETLK,&lock);
ret = sys_fcntl_ptr(fd,op,&lock);
if (ret == -1) {
int sav = errno;

View File

@ -2119,9 +2119,10 @@ static int vfswrap_kernel_flock(vfs_handle_struct *handle, files_struct *fsp,
static bool vfswrap_getlock(vfs_handle_struct *handle, files_struct *fsp, off_t *poffset, off_t *pcount, int *ptype, pid_t *ppid)
{
bool result;
int op = F_GETLK;
START_PROFILE(syscall_fcntl_getlock);
result = fcntl_getlock(fsp->fh->fd, poffset, pcount, ptype, ppid);
result = fcntl_getlock(fsp->fh->fd, op, poffset, pcount, ptype, ppid);
END_PROFILE(syscall_fcntl_getlock);
return result;
}