Page MenuHomeFreeBSD

micchie.gml_gmail.com (Michio Honda)
User

Projects

User does not belong to any projects.

User Details

User Since
Jun 8 2018, 2:49 PM (305 w, 6 d)

Recent Activity

Jun 20 2018

micchie.gml_gmail.com added a comment to D15706: socket: introduction of destructor callback.
In D15706#336214, @jtl wrote:
In D15706#334711, @jtl wrote:

Didn't quite catch this before it was committed. This isn't really a destructor, it's a close notification. Rather than confuse matters, as sockets have UMA destructors as well, this should probably be so_notify_close.

Yes, I caught that when I asked the submitter about the placement of the "destructor". But, once I figured out it was a close notification, I should have changed the name. Mea cupla.

Before changing this, let me see if I can confirm what the Linux implementation does.

Thanks, it is intended to be equivalent to sk_destruct() callback in struct sock in Linux.

Is the Linux sk_destruct called on socket close, or on socket destruction? If we want an actual socket destructor, we can add one of those [instead / as well], called from the socket destructor function.

It is literally destructor, which is called when the final reference count drops to zero. So probably we should define so_dtor() as destructor (so keep the name) and call it after SOCK_UNLOCK() in sofree(). (in Linux it is invoked without locking socket).

Which behavior do you want? As @rwatson indicated, you can both have a destructor and a close callback.

Just the destructor behaviour should suffice, but let me come back soon after checking.

I confirmed that the destructor behavior i.e., invoke it after SOCK_UNLOCK() in sofree() as below.
Or should I submit a new patch?

Jun 20 2018, 12:27 PM

Jun 18 2018

micchie.gml_gmail.com added a comment to D15706: socket: introduction of destructor callback.
In D15706#336214, @jtl wrote:
In D15706#334711, @jtl wrote:

Didn't quite catch this before it was committed. This isn't really a destructor, it's a close notification. Rather than confuse matters, as sockets have UMA destructors as well, this should probably be so_notify_close.

Yes, I caught that when I asked the submitter about the placement of the "destructor". But, once I figured out it was a close notification, I should have changed the name. Mea cupla.

Before changing this, let me see if I can confirm what the Linux implementation does.

Thanks, it is intended to be equivalent to sk_destruct() callback in struct sock in Linux.

Is the Linux sk_destruct called on socket close, or on socket destruction? If we want an actual socket destructor, we can add one of those [instead / as well], called from the socket destructor function.

It is literally destructor, which is called when the final reference count drops to zero. So probably we should define so_dtor() as destructor (so keep the name) and call it after SOCK_UNLOCK() in sofree(). (in Linux it is invoked without locking socket).

Which behavior do you want? As @rwatson indicated, you can both have a destructor and a close callback.

Just the destructor behaviour should suffice, but let me come back soon after checking.

Jun 18 2018, 11:42 PM
micchie.gml_gmail.com added a comment to D15706: socket: introduction of destructor callback.
In D15706#334711, @jtl wrote:

Didn't quite catch this before it was committed. This isn't really a destructor, it's a close notification. Rather than confuse matters, as sockets have UMA destructors as well, this should probably be so_notify_close.

Yes, I caught that when I asked the submitter about the placement of the "destructor". But, once I figured out it was a close notification, I should have changed the name. Mea cupla.

Before changing this, let me see if I can confirm what the Linux implementation does.

Thanks, it is intended to be equivalent to sk_destruct() callback in struct sock in Linux.

Is the Linux sk_destruct called on socket close, or on socket destruction? If we want an actual socket destructor, we can add one of those [instead / as well], called from the socket destructor function.

It is literally destructor, which is called when the final reference count drops to zero. So probably we should define so_dtor() as destructor (so keep the name) and call it after SOCK_UNLOCK() in sofree(). (in Linux it is invoked without locking socket).

Jun 18 2018, 11:03 PM

Jun 15 2018

micchie.gml_gmail.com added a comment to D15706: socket: introduction of destructor callback.
In D15706#334711, @jtl wrote:

Didn't quite catch this before it was committed. This isn't really a destructor, it's a close notification. Rather than confuse matters, as sockets have UMA destructors as well, this should probably be so_notify_close.

Yes, I caught that when I asked the submitter about the placement of the "destructor". But, once I figured out it was a close notification, I should have changed the name. Mea cupla.

Before changing this, let me see if I can confirm what the Linux implementation does.

Jun 15 2018, 9:41 PM

Jun 8 2018

micchie.gml_gmail.com created D15706: socket: introduction of destructor callback.
Jun 8 2018, 3:00 PM