Lines Matching defs:conn
54 struct udev_ctrl_connection *conn;
175 struct udev_ctrl_connection *conn;
180 conn = new(struct udev_ctrl_connection, 1);
181 if (conn == NULL)
183 conn->refcount = 1;
184 conn->uctrl = uctrl;
186 conn->sock = accept4(uctrl->sock, NULL, NULL, SOCK_CLOEXEC|SOCK_NONBLOCK);
187 if (conn->sock < 0) {
194 r = getpeercred(conn->sock, &ucred);
205 r = setsockopt(conn->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on));
210 return conn;
212 if (conn->sock >= 0)
213 close(conn->sock);
214 free(conn);
218 struct udev_ctrl_connection *udev_ctrl_connection_ref(struct udev_ctrl_connection *conn) {
219 if (conn == NULL)
221 conn->refcount++;
222 return conn;
225 struct udev_ctrl_connection *udev_ctrl_connection_unref(struct udev_ctrl_connection *conn) {
226 if (conn && -- conn->refcount == 0) {
227 if (conn->sock >= 0)
228 close(conn->sock);
230 udev_ctrl_unref(conn->uctrl);
232 free(conn);
324 struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl_connection *conn) {
342 uctrl_msg->conn = conn;
343 udev_ctrl_connection_ref(conn);
350 pfd[0].fd = conn->sock;
374 size = recvmsg(conn->sock, &smsg, 0);
409 udev_ctrl_connection_unref(ctrl_msg->conn);