The question is on the highlighted clause in this excerpt from The Stranger by Camus.
Quelques jours après, on m'a isolé dans une cellule où je couchais sur un bat-flanc de bois. J'avais un baquet d'aisances et une cuvette de fer. La prison était tout en haut de la ville et, par une petite fenêtre, je [Meursault] pouvais voir la mer. C'est un jour que j'étais agrippé aux barreaux, mon visage tendu vers la lumière, qu'un gardien est entré et m'a dit que j'avais une visite. J'ai pensé que c'était Marie. C'était bien elle.
Question
How does the clause come to mean what it means? Is it from the transitive or the reflexive use of the verb agripper?
Background
I am afraid the question will not make much sense without the following explanation of the difficulty I am having.
The difficulty is that my (anyone's) usual strategy for dealing with a French passive did not work, which is to understand that the grammatical subject actually receives the action of the verb (in its active transitive sense). For example, if I saw il est fini, I would think il received finishing.
Applying that strategy to the Camus clause gave me Meursault getting grabbed by someone, which was not right.
So I had to explore doing something with s'agripper. First of all, it seemed to me that s'agripper was not like s'étonner.
The sense of s'étonner comes from (is related to) that of étonner in a more straightforward way. If vous vous étonnez then presumably you would be surprised. So this element of result or condition remains in the sense of s'étonner though we don't think the grammatical subject did some self-surprising.
But s'agripper cannot derive from (or be related to) agripper in the same way. When someone s'agrippe it does not follow that he is grabbed by any person or thing. The relevant sense of agripper in s'agripper would rather appear to be something like putting someone in a state of grabbing. (So je m'agrippe aux barreaux is I put myself in the state of grabbing the bars.) And this is the sense that seems to work with the Camus clause. It gives us: I had been put in the state of grabbing the bars.
In sum: The transitive use of agripper gave me no way of understanding the Camus clause. The reflexive use seemed to lend itself to one.