There is a little aside here that we should get to before we go past it, but it will not take long. When these verses are combined with Genesis 1:28-29 and Genesis 4:1-5, it shows that this is not mankind's introduction into eating animal flesh. You can read verse 3 in chapter 9. But in Genesis 1, what God is doing is showing that all life, animal and human, ultimately depends on vegetation: I have given you all the green herbs to eat. And that is true.
Remember Genesis 4:1-5. Abel brought to God an animal sacrifice. That shows us that God had already showed them that their dominion over animals extended to the place that they were able to take an animal's life. God was well pleased with Abel's animal sacrifice. He was so well pleased that it is recorded back in Hebrews 11 that it still witnesses. So God was not overly concerned about the killing of an animal, but what we need to understand is that they understood about sacrificing, and some of the sacrifices had to be eaten. That was a requirement of God. The sin offering was to be eaten, part of it anyway, and the peace offering was to be eaten.
In Ecclesiastes 1:2 the word translated vanity is hebel, and it literally means a breath, a vapor. Thus metaphorically it means transitory, worthless, insubstantial, emptiness. There is just nothing to it. It is futile, meaningless, without profit.
You are familiar with this word in another context altogether. In Genesis 4:2 it says, She again bare his brother Abel. The same word is translated Abel here, used as a proper noun, but it means exactly the same thing as vanity does in the book of Ecclesiastes. Abel was nothing more than a breath! We could say he was worthless, he was meaningless, he was futile. I do not know which side of the bed Eve got out of that morning whenever that child was named! Maybe God inspired it because He wanted to teach us something.