add: }
context: common_fcntl(int fd, int op, uint32 argument, bool kernel){	struct file_descriptor *descriptor;	struct vnode *vnode;	struct flock flock;	status_t status;	FUNCTION(("common_fcntl(fd = %d, op = %d, argument = %lx, %s)\n",		fd, op, argument, kernel ? "kernel" : "user"));	descriptor = get_fd_and_vnode(fd, &vnode, kernel);	if (descriptor == NULL)		return B_FILE_ERROR;	if (op == F_SETLK || op == F_SETLKW || op == F_GETLK) {		if (descriptor->type != FDTYPE_FILE)			return B_BAD_VALUE;		if (user_memcpy(&flock, (struct flock *)argument, sizeof(struct flock)) < B_OK)			return B_BAD_ADDRESS;	}	switch (op) {		case F_SETFD:			// Set file descriptor flags			// O_CLOEXEC is the only flag available at this time			if (argument == FD_CLOEXEC)				atomic_or(&descriptor->open_mode, O_CLOEXEC);			else				atomic_and(&descriptor->open_mode, O_CLOEXEC);			status = B_OK;			break;		case F_GETFD:			// Get file descriptor flags			status = (descriptor->open_mode & O_CLOEXEC) ? FD_CLOEXEC : 0;			break;		case F_SETFL:			// Set file descriptor open mode			if (FS_CALL(vnode, set_flags)) {				// we only accept changes to O_APPEND and O_NONBLOCK				argument &= O_APPEND | O_NONBLOCK;				status = FS_CALL(vnode, set_flags)(vnode->mount->cookie, vnode->private_node, descriptor->cookie, (int)argument);				if (status == B_OK) {					// update this descriptor's open_mode field					descriptor->open_mode = (descriptor->open_mode & ~(O_APPEND | O_NONBLOCK)) | argument;				}			} else				status = EOPNOTSUPP;			break;		case F_GETFL:			// Get file descriptor open mode			status = descriptor->open_mode;			break;		case F_DUPFD:			status = new_fd_etc(get_current_io_context(kernel), descriptor, (int)argument);			if (status >= 0)				atomic_add(&descriptor->ref_count, 1);			break;		case F_GETLK:			status = get_advisory_lock(descriptor->u.vnode, &flock);			if (status == B_OK) {				// copy back flock structure				status = user_memcpy((struct flock *)argument, &flock, sizeof(struct flock));			}			break;		case F_SETLK:		case F_SETLKW:			status = normalize_flock(descriptor, &flock);			if (status < B_OK)				break;			if (flock.l_type == F_UNLCK)				status = release_advisory_lock(descriptor->u.vnode, &flock);			else {				// the open mode must match the lock type				if ((descriptor->open_mode & O_RWMASK) == O_RDONLY && flock.l_type == F_WRLCK					|| (descriptor->open_mode & O_RWMASK) == O_WRONLY && flock.l_type == F_RDLCK)					status = B_FILE_ERROR;				else					status = acquire_advisory_lock(descriptor->u.vnode, &flock, op == F_SETLKW);			}			break;		// ToDo: add support for more ops?		default:			status = B_BAD_VALUE;	}	put_fd(descriptor);	return status;}