unix: mkdir VPP_RUN_DIR before opening a socket in it
[vpp.git] / src / vlib / unix / unix.h
index ea0d417..ffa92bb 100644 (file)
 #include <vppinfra/socket.h>
 #include <termios.h>
 
+
+/** VPP runtime ephemeral directory. Typically stored in a tmpfs. */
+#define VPP_RUN_DIR "/run/vpp"
+
 struct unix_file;
 typedef clib_error_t *(unix_file_function_t) (struct unix_file * f);
 
@@ -151,6 +155,14 @@ unix_file_del (unix_main_t * um, unix_file_t * f)
   pool_put (um->file_pool, f);
 }
 
+always_inline void
+unix_file_del_by_index (unix_main_t * um, uword index)
+{
+  unix_file_t *uf;
+  uf = pool_elt_at_index (um->file_pool, index);
+  unix_file_del (um, uf);
+}
+
 always_inline uword
 unix_file_set_data_available_to_write (u32 unix_file_index,
                                       uword is_available)
@@ -221,6 +233,8 @@ clib_error_t *foreach_directory_file (char *dir_name,
                                                           u8 * file_name),
                                      void *arg, int scan_dirs);
 
+clib_error_t *unix_make_vpp_run_dir (void);
+
 #endif /* included_unix_unix_h */
 
 /*