1 /*
2 * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3 * University Research and Technology
4 * Corporation. All rights reserved.
5 * Copyright (c) 2004-2011 The University of Tennessee and The University
6 * of Tennessee Research Foundation. All rights
7 * reserved.
8 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9 * University of Stuttgart. All rights reserved.
10 * Copyright (c) 2004-2005 The Regents of the University of California.
11 * All rights reserved.
12 * Copyright (c) 2008-2018 University of Houston. All rights reserved.
13 * Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
14 * Copyright (c) 2018 DataDirect Networks. All rights reserved.
15 * $COPYRIGHT$
16 *
17 * Additional copyrights may follow
18 *
19 * $HEADER$
20 */
21
22
23 #include "ompi_config.h"
24 #include "base.h"
25
26 #include <unistd.h>
27
28 #include "mpi.h"
29 #include "ompi/constants.h"
30 #include "ompi/mca/fs/fs.h"
31
32 /*
33 * file_delete_ufs
34 *
35 * Function: - deletes a file
36 * Accepts: - file name & info
37 * Returns: - Success if file closed
38 */
39 int mca_fs_base_file_delete (char* file_name,
40 struct opal_info_t *info)
41 {
42 int ret;
43
44 ret = unlink(file_name);
45
46 if (0 > ret ) {
47 if ( ENOENT == errno ) {
48 return MPI_ERR_NO_SUCH_FILE;
49 } else {
50 opal_output (0, "mca_fs_base_file_delete: Could not remove file "
51 "%s errno = %d %s\n",
52 file_name, errno, strerror(errno));
53 return MPI_ERR_ACCESS;
54 }
55 }
56
57 return OMPI_SUCCESS;
58 }