+/*
+ * Creates a wgt handle and connect it to 'dirfd' and 'pathname'.
+ *
+ * Returns the created and connected wgt handle on success
+ * or returns NULL if allocation failed or connecting had
+ * error.
+ */
+struct wgt *wgt_createat(int dirfd, const char *pathname)
+{
+ struct wgt *wgt = wgt_create();
+ if (wgt) {
+ if (wgt_connectat(wgt, dirfd, pathname)) {
+ wgt_unref(wgt);
+ wgt = NULL;
+ }
+ }
+ return wgt;
+}
+
+/*
+ * Connect 'wgt' to the directory of 'pathname' relative
+ * to the directory handled by 'dirfd'.
+ *
+ * Use AT_FDCWD for connecting relatively to the current directory.
+ *
+ * Use 'pathname' == NULL or "" for connecting to 'dirfd'. In
+ * that case, 'dirfd' is duplicated and can safely be used later
+ * by the client.
+ *
+ * If 'wgt' is already connected, it will be diconnected before.
+ *
+ * The languages settings are not changed.
+ *
+ * Returns 0 in case of success or -1 in case or error.
+ */