jlaitine commented on code in PR #8109: URL: https://github.com/apache/nuttx/pull/8109#discussion_r1072074656
########## fs/shm/shm_unlink.c: ########## @@ -0,0 +1,140 @@ +/**************************************************************************** + * fs/shm/shm_unlink.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <stdio.h> +#include <assert.h> +#include <errno.h> +#include "shm/shmfs.h" +#include "inode/inode.h" + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +static int file_shm_unlink(FAR const char *shm_name) +{ + FAR struct inode *inode; + struct inode_search_s desc; + char fullpath[sizeof(CONFIG_FS_SHMFS_VFS_PATH) + CONFIG_NAME_MAX + 2]; + int ret; + + /* Get the full path to the shm object */ + + snprintf(fullpath, sizeof(fullpath), + CONFIG_FS_SHMFS_VFS_PATH "/%s", shm_name); + + /* Get the inode for this shm object */ + + SETUP_SEARCH(&desc, fullpath, false); + + ret = inode_lock(); + if (ret < 0) + { + goto errout_with_search; + } + + ret = inode_find(&desc); + if (ret < 0) + { + /* There is no inode that includes in this path */ + + goto errout_with_sem; + } + + /* Get the search results */ + + inode = desc.node; + DEBUGASSERT(inode != NULL); + + /* Verify that what we found is, indeed, an shm inode */ + + if (!INODE_IS_SHM(inode)) + { + ret = -ENOENT; Review Comment: I don't think so. Acc. to posix spec, shm_unlink can only return errnos : ... [EACCES] <- this is not currently supported by nuttx fs in general Permission is denied to unlink the named shared memory object. [ENAMETOOLONG] The length of the name argument exceeds {PATH_MAX} or a pathname component is longer than {NAME_MAX}. [ENOENT] The named shared memory object does not exist. ... But, I added the ENAMETOOLONG, missing that was actually a bug -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org